forked from deriv-com/deriv-app
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
khalid/precommit hooks (deriv-com#5171)
* fixing dependency conflicts * test linting on core package * test linting on bot package * test linting on bot-ui package * test linting on account package * test linting on appstore package * test linting on ts file * test linting on jsx file and cashier package * test linting on components package * test linting on indicators package * test linting on p2p package * test linting on sass files * test linting on publisher package * test linting on shared package * test linting on trader package * cleanup * remove depracated babel-eslint * testing without babel-eslint * testing with added overrides * fix dependancy version conflicts * fix eslintrc to load babel plugins * test * allow empty commits * test Co-authored-by: Carol Sachdeva <58209918+carol-binary@users.noreply.github.com>
- Loading branch information
1 parent
5750bfb
commit 5041008
Showing
19 changed files
with
224 additions
and
185 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,110 +1,132 @@ | ||
module.exports = { | ||
root: true, | ||
parser: 'babel-eslint', | ||
plugins: ['prettier', 'testing-library'], | ||
env: { | ||
es6: true, | ||
browser: true, | ||
amd: true, | ||
mocha: true, | ||
jest: true, | ||
jquery: true, | ||
jasmine: true, | ||
}, | ||
globals: { | ||
dataLayer: true, | ||
texts_json: false, | ||
}, | ||
rules: { | ||
camelcase: 0, | ||
// semi : ['error', 'always'], | ||
'array-callback-return': 0, | ||
'arrow-body-style': 0, | ||
'brace-style': ['error', '1tbs', { allowSingleLine: true }], | ||
curly: 0, | ||
// 'comma-dangle' : ['error', 'always-multiline'], | ||
'eol-last': ['error', 'always'], | ||
'func-names': ['error', 'never'], | ||
'key-spacing': 0, | ||
'max-classes-per-file': ['warn', 2], | ||
// 'keyword-spacing' : ['error', { after: true }], | ||
'lines-between-class-members': 0, | ||
indent: 0, | ||
// 'max-len' : ['error', { code: 120, 'ignoreComments': true }], | ||
// 'no-extra-semi' : 'error', | ||
'no-console': 'error', | ||
'no-else-return': ['error', { allowElseIf: true }], | ||
'no-multi-assign': 0, | ||
// 'no-multi-spaces' : [2, { exceptions: { 'BinaryExpression': true, 'VariableDeclarator': true, 'ImportDeclaration': true } }], | ||
'no-param-reassign': ['error', { props: false }], | ||
'no-restricted-globals': 0, | ||
'no-script-url': 0, | ||
// 'no-trailing-spaces' : ['error', { skipBlankLines: true }], | ||
// 'object-curly-spacing' : ['error', 'always', { arraysInObjects: true, objectsInObjects: true }], | ||
'one-var': ['error', { initialized: 'never', uninitialized: 'always' }], | ||
'prefer-destructuring': 0, | ||
quotes: 0, | ||
// 'space-in-parens' : ['error', 'never'], | ||
'space-infix-ops': 'error', | ||
// 'space-unary-ops' : 'error', | ||
// 'no-multiple-empty-lines' : ['error', { 'max': 1, 'maxEOF': 1 }], | ||
root: true, | ||
parser: '@babel/eslint-parser', | ||
plugins: ['prettier', 'testing-library'], | ||
env: { | ||
es6: true, | ||
browser: true, | ||
amd: true, | ||
mocha: true, | ||
jest: true, | ||
jquery: true, | ||
jasmine: true, | ||
}, | ||
globals: { | ||
dataLayer: true, | ||
texts_json: false, | ||
}, | ||
rules: { | ||
camelcase: 0, | ||
// semi : ['error', 'always'], | ||
'array-callback-return': 0, | ||
'arrow-body-style': 0, | ||
'brace-style': ['error', '1tbs', { allowSingleLine: true }], | ||
curly: 0, | ||
// 'comma-dangle' : ['error', 'always-multiline'], | ||
'eol-last': ['error', 'always'], | ||
'func-names': ['error', 'never'], | ||
'key-spacing': 0, | ||
'max-classes-per-file': ['warn', 2], | ||
// 'keyword-spacing' : ['error', { after: true }], | ||
'lines-between-class-members': 0, | ||
indent: 0, | ||
// 'max-len' : ['error', { code: 120, 'ignoreComments': true }], | ||
// 'no-extra-semi' : 'error', | ||
'no-console': 'error', | ||
'no-else-return': ['error', { allowElseIf: true }], | ||
'no-multi-assign': 0, | ||
// 'no-multi-spaces' : [2, { exceptions: { 'BinaryExpression': true, 'VariableDeclarator': true, 'ImportDeclaration': true } }], | ||
'no-param-reassign': ['error', { props: false }], | ||
'no-restricted-globals': 0, | ||
'no-script-url': 0, | ||
// 'no-trailing-spaces' : ['error', { skipBlankLines: true }], | ||
// 'object-curly-spacing' : ['error', 'always', { arraysInObjects: true, objectsInObjects: true }], | ||
'one-var': ['error', { initialized: 'never', uninitialized: 'always' }], | ||
'prefer-destructuring': 0, | ||
quotes: 0, | ||
// 'space-in-parens' : ['error', 'never'], | ||
'space-infix-ops': 'error', | ||
// 'space-unary-ops' : 'error', | ||
// 'no-multiple-empty-lines' : ['error', { 'max': 1, 'maxEOF': 1 }], | ||
|
||
// import rules | ||
'import/no-extraneous-dependencies': ['error', { 'devDependencies': ['**/__tests__/**/*.js', '**/test*.js', '**/*.test.js*', '**/*.spec.js', '**/*.spec.jsx'] }], | ||
// import rules | ||
'import/no-extraneous-dependencies': [ | ||
'error', | ||
{ | ||
devDependencies: [ | ||
'**/__tests__/**/*.js', | ||
'**/test*.js', | ||
'**/*.test.js*', | ||
'**/*.spec.js', | ||
'**/*.spec.jsx', | ||
], | ||
}, | ||
], | ||
|
||
'import/no-useless-path-segments': 'error', | ||
'import/order': [ | ||
0, // TODO: we should turn this to error after we sorted our import orders. | ||
{ | ||
groups: [['builtin', 'external'], 'internal', 'sibling', 'parent'], | ||
'newlines-between': 'ignore', | ||
}, | ||
], | ||
'import/prefer-default-export': 0, | ||
'import/extensions': ['warn', 'never', { jsx: 'always', json: 'always' }], | ||
'no-sequences': ['warn'], | ||
'import/no-unresolved': [ | ||
2, | ||
{ ignore: ['@deriv/components', '@deriv/shared'] }, | ||
], | ||
'import/no-useless-path-segments': 'error', | ||
'import/order': [ | ||
0, // TODO: we should turn this to error after we sorted our import orders. | ||
{ | ||
groups: [['builtin', 'external'], 'internal', 'sibling', 'parent'], | ||
'newlines-between': 'ignore', | ||
}, | ||
], | ||
'import/prefer-default-export': 0, | ||
'import/extensions': ['warn', 'never', { jsx: 'always', json: 'always' }], | ||
'no-sequences': ['warn'], | ||
'import/no-unresolved': [2, { ignore: ['@deriv/components', '@deriv/shared'] }], | ||
|
||
// react rules | ||
// 'jsx-quotes' : ['error', 'prefer-single'], | ||
// 'react/jsx-closing-bracket-location': ['error', { selfClosing: 'line-aligned', nonEmpty: 'line-aligned' }], | ||
// 'react/jsx-closing-tag-location' : 'error', | ||
// 'react/jsx-first-prop-new-line' : ['error', 'multiline-multiprop'], | ||
// 'react/jsx-indent' : ['error', 4], | ||
// 'react/jsx-indent-props' : ['error', 4], | ||
// 'react/jsx-max-props-per-line' : ['error', { when: 'multiline' }], | ||
// 'react/jsx-tag-spacing' : ['error', { closingSlash: 'never', beforeSelfClosing: 'always' }], | ||
'react/prop-types': 0, | ||
'react/self-closing-comp': 'error', | ||
// 'react/sort-prop-types' : ['error', { ignoreCase: true, sortShapeProp: true }], | ||
}, | ||
extends: [ | ||
'prettier', | ||
'prettier/react', | ||
'airbnb-base', | ||
'binary', | ||
'plugin:react/recommended', | ||
'plugin:react-hooks/recommended', | ||
'plugin:jest-dom/recommended', | ||
], | ||
parserOptions: { | ||
ecmaVersion: 6, | ||
ecmaFeatures: { | ||
jsx: true, | ||
// react rules | ||
// 'jsx-quotes' : ['error', 'prefer-single'], | ||
// 'react/jsx-closing-bracket-location': ['error', { selfClosing: 'line-aligned', nonEmpty: 'line-aligned' }], | ||
// 'react/jsx-closing-tag-location' : 'error', | ||
// 'react/jsx-first-prop-new-line' : ['error', 'multiline-multiprop'], | ||
// 'react/jsx-indent' : ['error', 4], | ||
// 'react/jsx-indent-props' : ['error', 4], | ||
// 'react/jsx-max-props-per-line' : ['error', { when: 'multiline' }], | ||
// 'react/jsx-tag-spacing' : ['error', { closingSlash: 'never', beforeSelfClosing: 'always' }], | ||
'react/prop-types': 0, | ||
'react/self-closing-comp': 'error', | ||
// 'react/sort-prop-types' : ['error', { ignoreCase: true, sortShapeProp: true }], | ||
}, | ||
}, | ||
settings: { | ||
react: { | ||
version: '16', | ||
extends: [ | ||
'prettier', | ||
'prettier/react', | ||
'airbnb-base', | ||
'binary', | ||
'plugin:react/recommended', | ||
'plugin:react-hooks/recommended', | ||
'plugin:jest-dom/recommended', | ||
], | ||
parserOptions: { | ||
requireConfigFile: false, | ||
ecmaVersion: 8, | ||
babelOptions: { | ||
presets: ['@babel/preset-react', '@babel/preset-typescript'], | ||
plugins: [ | ||
['@babel/plugin-proposal-decorators', { legacy: true }], | ||
['@babel/plugin-proposal-class-properties', { loose: true }], | ||
'@babel/plugin-proposal-export-default-from', | ||
'@babel/plugin-proposal-object-rest-spread', | ||
'@babel/plugin-proposal-export-namespace-from', | ||
'@babel/plugin-syntax-dynamic-import', | ||
'@babel/plugin-proposal-optional-chaining', | ||
'@babel/plugin-proposal-nullish-coalescing-operator', | ||
], | ||
}, | ||
ecmaFeatures: { | ||
jsx: true, | ||
}, | ||
}, | ||
}, | ||
overrides: [ | ||
{ | ||
files: ['**/__tests__/**/*.[jt]s?(x)', '**/?(*.)+(spec|test).[jt]s?(x)'], | ||
extends: ['plugin:testing-library/react'], | ||
settings: { | ||
react: { | ||
version: '16', | ||
}, | ||
}, | ||
], | ||
overrides: [ | ||
{ | ||
files: ['**/__tests__/**/*.[jt]s?(x)', '**/?(*.)+(spec|test).[jt]s?(x)'], | ||
extends: ['plugin:testing-library/react'], | ||
}, | ||
], | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
#!/bin/sh | ||
. "$(dirname "$0")/_/husky.sh" | ||
|
||
npm run prettify | ||
npx lint-staged --allow-empty |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
{ | ||
"*.{js,jsx,ts,tsx,md,html,css,scss}": "prettier --write", | ||
"*.{js,jsx,ts,tsx}": "npx eslint --fix", | ||
"*.{css,scss}": "npx stylelint --fix" | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Oops, something went wrong.