How to use eslint-config-react-app - 9 common examples

To help you get started, we’ve selected a few eslint-config-react-app 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 mmazzarolo / eslint-plugin-react-app / src / config.js View on Github external
const reactAppConfig = require("eslint-config-react-app");

const rules = {};

// Is the rule part of an eslint plugin?
const isPluginRule = ruleName => {
  for (const plugin of plugins) {
    if (ruleName.indexOf(`${plugin.rulePrefix}/`) !== -1) {
      return true;
    }
  }
  return false;
};

// Renames the plugins rules prefixing them with 'react-app'
Object.keys(reactAppConfig.rules).forEach(ruleName => {
  if (isPluginRule(ruleName)) {
    rules[`react-app/${ruleName}`] = reactAppConfig.rules[ruleName];
  } else {
    rules[ruleName] = reactAppConfig.rules[ruleName];
  }
});

module.exports = {
  parser: reactAppConfig.parser,
  plugins: ["react-app"],
  rules,
  settings: reactAppConfig.settings,
  env: reactAppConfig.env,
  root: reactAppConfig.root,
  parserOptions: reactAppConfig.parserOptions,
  overrides: reactAppConfig.overrides
github mmazzarolo / eslint-plugin-react-app / src / config.js View on Github external
// Renames the plugins rules prefixing them with 'react-app'
Object.keys(reactAppConfig.rules).forEach(ruleName => {
  if (isPluginRule(ruleName)) {
    rules[`react-app/${ruleName}`] = reactAppConfig.rules[ruleName];
  } else {
    rules[ruleName] = reactAppConfig.rules[ruleName];
  }
});

module.exports = {
  parser: reactAppConfig.parser,
  plugins: ["react-app"],
  rules,
  settings: reactAppConfig.settings,
  env: reactAppConfig.env,
  root: reactAppConfig.root,
  parserOptions: reactAppConfig.parserOptions,
  overrides: reactAppConfig.overrides
};
github mmazzarolo / eslint-plugin-react-app / src / config.js View on Github external
}
  }
  return false;
};

// Renames the plugins rules prefixing them with 'react-app'
Object.keys(reactAppConfig.rules).forEach(ruleName => {
  if (isPluginRule(ruleName)) {
    rules[`react-app/${ruleName}`] = reactAppConfig.rules[ruleName];
  } else {
    rules[ruleName] = reactAppConfig.rules[ruleName];
  }
});

module.exports = {
  parser: reactAppConfig.parser,
  plugins: ["react-app"],
  rules,
  settings: reactAppConfig.settings,
  env: reactAppConfig.env,
  root: reactAppConfig.root,
  parserOptions: reactAppConfig.parserOptions,
  overrides: reactAppConfig.overrides
};
github mmazzarolo / eslint-plugin-react-app / src / config.js View on Github external
// Renames the plugins rules prefixing them with 'react-app'
Object.keys(reactAppConfig.rules).forEach(ruleName => {
  if (isPluginRule(ruleName)) {
    rules[`react-app/${ruleName}`] = reactAppConfig.rules[ruleName];
  } else {
    rules[ruleName] = reactAppConfig.rules[ruleName];
  }
});

module.exports = {
  parser: reactAppConfig.parser,
  plugins: ["react-app"],
  rules,
  settings: reactAppConfig.settings,
  env: reactAppConfig.env,
  root: reactAppConfig.root,
  parserOptions: reactAppConfig.parserOptions,
  overrides: reactAppConfig.overrides
};
github mmazzarolo / eslint-plugin-react-app / src / config.js View on Github external
};

// Renames the plugins rules prefixing them with 'react-app'
Object.keys(reactAppConfig.rules).forEach(ruleName => {
  if (isPluginRule(ruleName)) {
    rules[`react-app/${ruleName}`] = reactAppConfig.rules[ruleName];
  } else {
    rules[ruleName] = reactAppConfig.rules[ruleName];
  }
});

module.exports = {
  parser: reactAppConfig.parser,
  plugins: ["react-app"],
  rules,
  settings: reactAppConfig.settings,
  env: reactAppConfig.env,
  root: reactAppConfig.root,
  parserOptions: reactAppConfig.parserOptions,
  overrides: reactAppConfig.overrides
};
github mmazzarolo / eslint-plugin-react-app / src / config.js View on Github external
Object.keys(reactAppConfig.rules).forEach(ruleName => {
  if (isPluginRule(ruleName)) {
    rules[`react-app/${ruleName}`] = reactAppConfig.rules[ruleName];
  } else {
    rules[ruleName] = reactAppConfig.rules[ruleName];
  }
});
github umijs / umi / packages / eslint-config-umi / src / index.js View on Github external
import reactAppConfig from 'eslint-config-react-app';

export default {
  ...reactAppConfig,
  rules: {
    ...reactAppConfig.rules,
    strict: [0],
    'no-sequences': [0],
    'no-mixed-operators': [0],
    'react/react-in-jsx-scope': [0],
    'no-useless-escape': [0],
  },
  settings: {
    react: {
      version: '16.8',
    },
  },
};
github mmazzarolo / eslint-plugin-react-app / src / config.js View on Github external
if (isPluginRule(ruleName)) {
    rules[`react-app/${ruleName}`] = reactAppConfig.rules[ruleName];
  } else {
    rules[ruleName] = reactAppConfig.rules[ruleName];
  }
});

module.exports = {
  parser: reactAppConfig.parser,
  plugins: ["react-app"],
  rules,
  settings: reactAppConfig.settings,
  env: reactAppConfig.env,
  root: reactAppConfig.root,
  parserOptions: reactAppConfig.parserOptions,
  overrides: reactAppConfig.overrides
};
github mmazzarolo / eslint-plugin-react-app / src / config.js View on Github external
Object.keys(reactAppConfig.rules).forEach(ruleName => {
  if (isPluginRule(ruleName)) {
    rules[`react-app/${ruleName}`] = reactAppConfig.rules[ruleName];
  } else {
    rules[ruleName] = reactAppConfig.rules[ruleName];
  }
});

module.exports = {
  parser: reactAppConfig.parser,
  plugins: ["react-app"],
  rules,
  settings: reactAppConfig.settings,
  env: reactAppConfig.env,
  root: reactAppConfig.root,
  parserOptions: reactAppConfig.parserOptions,
  overrides: reactAppConfig.overrides
};

eslint-config-react-app

ESLint configuration used by Create React App

MIT
Latest version published 3 years ago

Package Health Score

88 / 100
Full package analysis