How to use the eslint-config-fbjs.rules function in eslint-config-fbjs

To help you get started, we’ve selected a few eslint-config-fbjs examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github facebook / jest / packages / eslint-config-fb-strict / index.js View on Github external
// Can't be ESModules as this is not compiled
const fbjsConfig = require('eslint-config-fbjs');

const variableNamePattern = String.raw`\s*[a-zA-Z_$][a-zA-Z_$\d]*\s*`;
const importPattern =
  String.raw`^(?:var|let|const|import type)\s+` +
  '{?' +
  variableNamePattern +
  '(?:,' +
  variableNamePattern +
  ')*}?' +
  String.raw`\s*(?:=\s*require\(|from)[a-zA-Z_+./''\s\d\-]+\)?[^;\n]*[;\n]`;
const maxLenIgnorePattern = String.raw`(^\s*(it|test)\(|${importPattern})`;

delete fbjsConfig.rules['babel/flow-object-type'];

module.exports = Object.assign({}, fbjsConfig, {
  env: {
    es6: true,
    'jest/globals': true,
    node: true,
  },
  plugins: fbjsConfig.plugins.concat(['jest']),
  rules: Object.assign({}, fbjsConfig.rules, {
    'array-bracket-spacing': [2, 'never'],
    'arrow-parens': [2, 'as-needed'],
    'arrow-spacing': [2],
    'brace-style': [
      2,
      '1tbs',
      {
github facebook / jest / packages / eslint-config-fb-strict / index.js View on Github external
'(?:,' +
  variableNamePattern +
  ')*}?' +
  String.raw`\s*(?:=\s*require\(|from)[a-zA-Z_+./''\s\d\-]+\)?[^;\n]*[;\n]`;
const maxLenIgnorePattern = String.raw`(^\s*(it|test)\(|${importPattern})`;

delete fbjsConfig.rules['babel/flow-object-type'];

module.exports = Object.assign({}, fbjsConfig, {
  env: {
    es6: true,
    'jest/globals': true,
    node: true,
  },
  plugins: fbjsConfig.plugins.concat(['jest']),
  rules: Object.assign({}, fbjsConfig.rules, {
    'array-bracket-spacing': [2, 'never'],
    'arrow-parens': [2, 'as-needed'],
    'arrow-spacing': [2],
    'brace-style': [
      2,
      '1tbs',
      {
        allowSingleLine: true,
      },
    ],
    'comma-dangle': [2, 'always-multiline'],
    'comma-spacing': [2],
    'comma-style': [2, 'last'],
    'computed-property-spacing': [2, 'never'],
    'eol-last': [2],
    'flowtype/object-type-delimiter': [2, 'comma'],

eslint-config-fbjs

For the most part, this configuration matches the ESLint configuration we have internally at Facebook.

MIT
Latest version published 2 years ago

Package Health Score

62 / 100
Full package analysis

Popular eslint-config-fbjs functions