Skip to content

Commit

Permalink
style: improve lint config
Browse files Browse the repository at this point in the history
  • Loading branch information
ottodevs committed Jan 30, 2020
1 parent eea08d7 commit caad21a
Show file tree
Hide file tree
Showing 3 changed files with 60 additions and 51 deletions.
1 change: 1 addition & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,4 @@ build
.cache
dist
coverage
!.eslintrc.js
96 changes: 51 additions & 45 deletions .eslintrc.js
Original file line number Diff line number Diff line change
@@ -1,65 +1,71 @@
const ignoreExports = [
'.eslintrc.js',
'app/script.js',
'app/script.test.js',
'commitlint.config.js',
'test/About.test.js',
'truffle-config.js',
// TODO: Fix index exports
'**/index.js',
]

module.exports = {
env: {
browser: true,
commonjs: true,
es6: true,
node: true,
commonjs: true,
},
extends: [
'standard', 'standard-react',
'eslint:recommended',
'plugin:import/errors',
'plugin:react/recommended',
'plugin:react/recommended', // will import plugin and enable jsx in parser options
'plugin:jsx-a11y/recommended',
],
parser: 'babel-eslint',
parserOptions: {
ecmaFeatures: {
jsx: true
},
ecmaVersion: 2018,
sourceType: 'module'
},
plugins: ['react'],
plugins: [ 'react-hooks', 'sort-keys-fix' ],
rules: {
'arrow-parens': ["error", "as-needed"],
indent: ['error', 2],
'linebreak-style': ['error', 'unix'],
quotes: ['error', 'single'],
'react/no-typos': 1,
semi: ['error', 'never'],
'array-bracket-spacing': [
'error',
'always',
{
objectsInArrays: false,
arraysInArrays: false,
singleValue: false
}
],
'func-style': ["warn", "declaration", { "allowArrowFunctions": true }],
'object-curly-spacing': ['error', 'always'],
// "import/no-unused-modules": [
// "warn",
// {
// unusedExports: true,
// missingExports: true,
// ignoreExports: [],
// }
// ],
"no-undef": "error",
"no-unused-vars": ["warn", { "vars": "all", "args": "after-used", "ignoreRestSiblings": false }],
'no-console': ['warn', { allow: ['warn', 'error'] }],
"react/jsx-uses-react": "warn",
"react/jsx-uses-vars": "warn",
"react/jsx-filename-extension": "off",
"react/no-unused-prop-types": "warn",
"react/self-closing-comp": ["error", {"component": true, "html": true}],
"sort-imports": ["warn", { "ignoreDeclarationSort": true }]
'array-bracket-spacing': [ 'error', 'always', { singleValue: false } ],
'arrow-parens': [ 'error', 'as-needed' ],
'comma-dangle': [ 'error', 'always-multiline' ],
'comma-spacing': ['error'],
'func-style': [ 'warn', 'declaration', { 'allowArrowFunctions': true } ],
'import/no-unresolved': ['error'],
'import/no-unused-modules': [ 'error', { ignoreExports, missingExports: true, unusedExports: true } ],
'indent': [ 'error', 2 ],
'linebreak-style': [ 'error', 'unix' ],
'no-console': [ 'warn', { allow: [ 'warn', 'error' ] } ],
'no-multi-spaces': 'error',
'no-trailing-spaces': ['error'],
'no-undef': 'error',
'no-unused-vars': [ 'warn', { 'args': 'after-used', 'ignoreRestSiblings': false, 'vars': 'all' } ],
'object-curly-spacing': [ 'error', 'always' ],
'quotes': [ 'error', 'single' ],
'react-hooks/exhaustive-deps': 'error',
'react-hooks/rules-of-hooks': 'error',
'react/default-props-match-prop-types': ['error'],
'react/destructuring-assignment': [ 'error', 'always' ],
'react/forbid-prop-types': ['warn'],
'react/function-component-definition': [ 'error', { 'namedComponents': 'arrow-function', 'unnamedComponents': 'function-expression' } ],
'react/no-array-index-key': 'warn',
'react/no-danger': 'error',
'react/no-typos': 'error',
'react/no-unused-prop-types': 'warn',
'react/require-default-props': ['error'],
'react/self-closing-comp': [ 'error', { 'component': true, 'html': true } ],
'react/sort-comp': ['error'],
'react/sort-prop-types': [ 'error', { 'ignoreCase': true, 'sortShapeProp': 'true' } ],
'react/void-dom-elements-no-children': 'error',
'semi': [ 'error', 'never' ],
'sort-imports': [ 'error', { 'ignoreDeclarationSort': true } ],
'sort-keys-fix/sort-keys-fix': 'error',
},
settings: {
react: {
version: 'detect',
}
}
react: { version: 'detect' },
},
}

14 changes: 8 additions & 6 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@
"@types/react": "^16.8.6",
"acorn": "^6.1.1",
"ava": "^1.4.1",
"babel-eslint": "^10.0.1",
"babel-eslint": "^10.0.3",
"babel-plugin-styled-components": "^1.10.0",
"copyfiles": "^2.1.1",
"coveralls": "3.0.2",
Expand All @@ -52,12 +52,14 @@
"eslint-config-prettier": "^6.0.0",
"eslint-config-standard": "^12.0.0",
"eslint-config-standard-react": "^7.0.2",
"eslint-plugin-import": "^2.17.3",
"eslint-plugin-import": "^2.20.0",
"eslint-plugin-jsx-a11y": "^6.2.1",
"eslint-plugin-node": "^9.1.0",
"eslint-plugin-promise": "^4.1.1",
"eslint-plugin-react": "^7.13.0",
"eslint-plugin-standard": "^4.0.0",
"eslint-plugin-node": "^9.2.0",
"eslint-plugin-promise": "^4.2.1",
"eslint-plugin-react": "^7.18.0",
"eslint-plugin-react-hooks": "^2.3.0",
"eslint-plugin-sort-keys-fix": "^1.1.0",
"eslint-plugin-standard": "^4.0.1",
"eth-gas-reporter": "0.1.12",
"ethereumjs-abi": "0.6.5",
"ganache-cli": "6.1.8",
Expand Down

0 comments on commit caad21a

Please sign in to comment.