Skip to content

Instantly share code, notes, and snippets.

@brainomite
Last active February 6, 2021 15:04
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save brainomite/d259b1d17b1d70959ab5c6f6ecd019a9 to your computer and use it in GitHub Desktop.
Save brainomite/d259b1d17b1d70959ab5c6f6ecd019a9 to your computer and use it in GitHub Desktop.
Eslint Configs
module.exports = {
env: {
browser: true,
es2021: true,
},
extends: ["airbnb-base", "prettier"],
parserOptions: {
ecmaVersion: 12,
sourceType: "module",
},
rules: {
"id-length": [ // turn on rule that checks length of variables
"error", // trigger an error if a variable is less than min length
{
min: 2, // set minimum length to 2
exceptions: ["_"], // used for packages, lodash and underscore
},
],
},
};
module.exports = {
env: {
browser: true,
commonjs: true,
es2021: true,
},
extends: ["airbnb-base", "prettier"],
parserOptions: {
ecmaVersion: 12,
},
rules: {
"id-length": [ // turn on rule that checks length of variables
"error", // trigger an error if a variable is less than min length
{
min: 2, // set minimum length to 2
exceptions: ["_"], // used for packages, lodash and underscore
},
],
},
};
module.exports = {
env: {
browser: true,
es2021: true,
},
extends: ["plugin:react/recommended", "airbnb", "prettier", "prettier/react"],
parserOptions: {
ecmaFeatures: {
jsx: true,
},
ecmaVersion: 12,
sourceType: "module",
},
plugins: ["react"],
rules: {
"id-length": [
// turn on rule that checks length of variables
"error", // trigger an error if a variable is less than min length
{
min: 2, // set minimum length to 2
exceptions: ["_"], // used for packages, lodash and underscore
},
],
// the following overrules the AirBnB style guide for react
"react/jsx-filename-extension": [1, { extensions: [".js", ".jsx"] }],
// https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/jsx-filename-extension.md
"react/destructuring-assignment": "off",
// https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/destructuring-assignment.md
"default-props-match-prop-types": "off",
// https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/default-props-match-prop-types.md
"react/require-default-props": "off",
// https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/require-default-props.md
"react/style-prop-object": "off",
// https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/style-prop-object.md
"react/jsx-no-target-blank": "off",
// https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/jsx-no-target-blank.md
"react/prop-types": "off",
// https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/prop-types.md
"react/no-array-index-key": "off",
// https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/no-array-index-key.md
},
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment