|
module.exports = { |
|
"extends": [ |
|
//"react-app", // only if is `create-react-app` application |
|
"airbnb", |
|
"prettier", |
|
"prettier/react" |
|
], |
|
"parser": "babel-eslint", |
|
"parserOptions": { |
|
"ecmaVersion": 8, |
|
"ecmaFeatures": { |
|
"experimentalObjectRestSpread": true, |
|
"impliedStrict": true, |
|
"classes": true |
|
} |
|
}, |
|
"env": { |
|
"browser": true, |
|
"node": true, |
|
"jquery": true, |
|
"jest": true |
|
}, |
|
"rules": { |
|
|
|
// Disallow the use of debugger |
|
"no-debugger": 0, |
|
|
|
// Disallow the use of alert, confirm, and prompt |
|
"no-alert": 0, |
|
|
|
// Disallow unused variables |
|
"no-unused-vars": [ |
|
1, |
|
{ |
|
"ignoreSiblings": true, |
|
"argsIgnorePattern": "res|next|^err" |
|
} |
|
], |
|
|
|
// Require const declarations for variables that are never reassigned after declared |
|
// "prefer-const": [ |
|
// "error", |
|
// { |
|
// "destructuring": "all" |
|
// } |
|
// ], |
|
|
|
// Require destructuring from arrays and/or objects |
|
"prefer-destructuring": ["error", { |
|
"object": false, |
|
"array": false |
|
}], |
|
|
|
// require braces around arrow function bodies |
|
"arrow-body-style": [ |
|
2, |
|
"as-needed" |
|
], |
|
|
|
// disallow unused expressions |
|
"no-unused-expressions": [ |
|
2, |
|
{ |
|
"allowTaggedTemplates": true |
|
} |
|
], |
|
|
|
// disallow reassigning function parameters |
|
"no-param-reassign": [ |
|
2, |
|
{ |
|
"props": false |
|
} |
|
], |
|
|
|
// disallow the use of console |
|
"no-console": 0, |
|
|
|
// require or disallow named function expressions |
|
"func-names": 0, |
|
|
|
// enforce consistent spacing before function definition opening parenthesis |
|
"space-before-function-paren": 0, |
|
|
|
// require or disallow trailing commas |
|
"comma-dangle": 0, |
|
|
|
// enforce a maximum line length (80) |
|
"max-len": 0, |
|
|
|
// disallow dangling underscores in identifiers |
|
"no-underscore-dangle": 0, |
|
|
|
// require return statements to either always or never specify values |
|
"consistent-return": 0, |
|
|
|
// enforce the consistent use of the radix argument when using parseInt() |
|
"radix": 0, |
|
|
|
// disallow variable declarations from shadowing variables declared in the outer scope |
|
"no-shadow": [ |
|
2, |
|
{ |
|
"hoist": "all", |
|
"allow": [ |
|
"resolve", |
|
"reject", |
|
"done", |
|
"next", |
|
"err", |
|
"error" |
|
] |
|
} |
|
], |
|
|
|
// enforce the consistent use of either backticks, double, or single quotes |
|
"quotes": [ |
|
2, |
|
"single", |
|
{ |
|
"avoidEscape": true, |
|
"allowTemplateLiterals": true |
|
} |
|
], |
|
|
|
// support linting of ES2015+ (ES6+) import/export syntax, |
|
"import": 0, |
|
|
|
// When there is only a single export from a module, prefer using default export over named export. |
|
"import/prefer-default-export": 0, |
|
|
|
// A list of file extensions that will be parsed as modules and inspected for exports. |
|
"import/extensions": 0, |
|
|
|
|
|
// ---------- React ---------- |
|
// DisplayName allows you to name your component. This name is used by React in debugging messages. |
|
"react/display-name": 1, |
|
|
|
// Prevent using Array index in key props |
|
"react/no-array-index-key": 0, |
|
|
|
// Prevent missing React when using JSX |
|
"react/react-in-jsx-scope": 0, |
|
|
|
// Enforce stateless React Components to be written as a pure function |
|
"react/prefer-stateless-function": 0, |
|
|
|
// Forbid certain propTypes |
|
"react/forbid-prop-types": 0, |
|
|
|
// Prevent invalid characters from appearing in markup |
|
"react/no-unescaped-entities": 0, |
|
|
|
// Enforce a defaultProps definition for every prop that is not a required prop |
|
"react/require-default-props": 0, |
|
|
|
// Prevent missing props validation in a React component definition |
|
// avoid error in (props.query) [https://github.com/yannickcr/eslint-plugin-react/issues/1257] |
|
// "react/prop-types": [ |
|
// "enabled", |
|
// { |
|
// "ignore": "ignore", |
|
// "customValidators": "customValidator" |
|
// } |
|
// ], |
|
|
|
// ---------- JSX ---------- |
|
|
|
// allow emoji (<span role="img" aria-label="Panda">🐼</span>) |
|
"jsx-a11y/accessible-emoji": 0, |
|
|
|
// Restrict file extensions that may contain JSX |
|
"react/jsx-filename-extension": [ |
|
1, |
|
{ |
|
"extensions": [ |
|
".js", |
|
".jsx" |
|
] |
|
} |
|
], |
|
|
|
// Enforce all anchors are valid, navigable elements. |
|
"jsx-a11y/anchor-is-valid": [ |
|
"warn", |
|
{ |
|
"aspects": [ |
|
"invalidHref" |
|
] |
|
} |
|
], |
|
|
|
// ---------- Prettier ---------- |
|
"prettier/prettier": [ |
|
"error", |
|
{ |
|
"trailingComma": "es5", // commas at the end ES5 (objects, arrays, etc.) |
|
"singleQuote": true, // Use single quotes instead of double quotes. |
|
"printWidth": 80, // Width of the column before breaking it |
|
"jsxBracketSameLine": true // place the > symbol at the end of the last line instead of a new line |
|
} |
|
], |
|
}, |
|
"plugins": [ |
|
"prettier" |
|
] |
|
}; |