This repository has been archived by the owner on Mar 13, 2023. It is now read-only.
-
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.
Merge pull request #1 from nxt-insurance/dgit-ts-eslint
Eslint for playground specific to typescript [do not merge]
- Loading branch information
Showing
11 changed files
with
1,002 additions
and
133 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,126 +1,12 @@ | ||
module.exports = { | ||
plugins: ['flowtype', 'import', 'prettier', 'promise', 'react', 'react-hooks'], | ||
extends: ['plugin:flowtype/recommended', 'plugin:react/recommended', 'airbnb', 'prettier'], | ||
rules: { | ||
'prettier/prettier': [ | ||
'error', | ||
{ | ||
semi: false, | ||
trailingComma: 'es5', | ||
printWidth: 100, | ||
singleQuote: true, | ||
}, | ||
], | ||
camelcase: 'off', | ||
curly: ['error', 'all'], | ||
eqeqeq: ['error', 'always'], | ||
radix: ['error', 'as-needed'], | ||
'arrow-body-style': 'off', | ||
'consistent-return': 'off', | ||
'global-require': 'off', | ||
'lines-between-class-members': ['error', 'always', { exceptAfterSingleLine: true }], | ||
'no-async-promise-executor': 'error', | ||
'no-await-in-loop': 'off', | ||
'no-console': ['error', { allow: ['error', 'groupCollapsed', 'groupEnd'] }], | ||
'no-else-return': 'off', | ||
'no-underscore-dangle': 'off', | ||
'no-unused-expressions': 'off', // this rule is replaced by 'flowtype/no-unused-expressions' | ||
'prefer-destructuring': [ | ||
'error', | ||
{ | ||
AssignmentExpression: { array: false, object: false }, | ||
}, | ||
], | ||
'prefer-promise-reject-errors': ['error', { allowEmptyReject: true }], | ||
|
||
'import/default': 'error', | ||
'import/dynamic-import-chunkname': ['error'], | ||
'import/export': 'error', | ||
'import/first': 'error', | ||
'import/named': 'error', | ||
'import/namespace': ['error', { allowComputed: true }], | ||
'import/newline-after-import': 'error', | ||
'import/no-anonymous-default-export': 'error', | ||
'import/no-deprecated': 'error', | ||
'import/no-duplicates': 'error', | ||
'import/no-mutable-exports': 'error', | ||
'import/no-named-as-default': 'error', | ||
'import/no-named-as-default-member': 'error', | ||
'import/no-named-default': 'error', | ||
'import/no-self-import': 'error', | ||
'import/no-unresolved': ['error', { commonjs: true }], | ||
'import/no-unused-modules': ['error', { unusedExports: true }], | ||
'import/no-useless-path-segments': ['error', { noUselessIndex: true }], | ||
'import/order': [ | ||
'error', | ||
{ | ||
groups: [['builtin', 'external'], 'internal', ['parent', 'sibling', 'index']], | ||
'newlines-between': 'always', | ||
}, | ||
], | ||
'import/prefer-default-export': 'off', | ||
|
||
'promise/catch-or-return': 'error', | ||
'promise/no-callback-in-promise': 'error', | ||
'promise/no-nesting': 'error', | ||
'promise/no-return-in-finally': 'error', | ||
'promise/no-return-wrap': 'error', | ||
'promise/param-names': 'error', | ||
|
||
'react/destructuring-assignment': 'off', | ||
'react/jsx-filename-extension': ['error', { extensions: ['.js'] }], | ||
'react/jsx-props-no-spreading': 'off', | ||
'react/no-danger': 'off', | ||
'react/prop-types': 'off', | ||
'react/require-default-props': 'off', | ||
// Disable stylistic rules. Prettier takes care of formatting. | ||
'react/jsx-wrap-multilines': 'off', | ||
'react/jsx-indent': 'off', | ||
'react/jsx-one-expression-per-line': 'off', | ||
'react/jsx-curly-newline': 'off', | ||
|
||
'react-hooks/rules-of-hooks': 'error', | ||
'react-hooks/exhaustive-deps': 'error', | ||
|
||
'flowtype/array-style-complex-type': ['error', 'shorthand'], | ||
'flowtype/array-style-simple-type': ['error', 'shorthand'], | ||
'flowtype/boolean-style': ['error', 'boolean'], | ||
'flowtype/define-flow-type': 'error', | ||
'flowtype/newline-after-flow-annotation': ['error', 'never'], | ||
'flowtype/no-dupe-keys': 'error', | ||
'flowtype/no-primitive-constructor-types': 'error', | ||
'flowtype/no-types-missing-file-annotation': ['error'], | ||
'flowtype/no-unused-expressions': ['error'], | ||
'flowtype/no-weak-types': 'error', | ||
'flowtype/require-exact-type': ['error', 'always'], | ||
'flowtype/require-return-type': [ | ||
'error', | ||
'always', | ||
{ | ||
annotateUndefined: 'never', | ||
excludeArrowFunctions: 'expressionsOnly', | ||
}, | ||
], | ||
'flowtype/require-types-at-top': 'error', | ||
'flowtype/require-valid-file-annotation': [ | ||
'error', | ||
'always', | ||
{ | ||
annotationStyle: 'line', | ||
}, | ||
], | ||
'flowtype/type-id-match': ['error', '^([A-Z]+[a-z0-9A-Z]*)$'], | ||
'flowtype/type-import-style': ['error', 'declaration'], | ||
'flowtype/use-flow-type': 'error', | ||
'flowtype/valid-syntax': 'error', | ||
// Disable stylistic rules. Prettier takes care of formatting. | ||
'flowtype/delimiter-dangle': 'off', | ||
'flowtype/generic-spacing': 'off', | ||
'flowtype/object-type-delimiter': 'off', | ||
'flowtype/semi': 'off', | ||
'flowtype/space-after-type-colon': 'off', | ||
'flowtype/space-before-generic-bracket': 'off', | ||
'flowtype/space-before-type-colon': 'off', | ||
'flowtype/union-intersection-spacing': 'off', | ||
}, | ||
extends: [ | ||
'airbnb', | ||
require.resolve('./rules/eslint.js'), | ||
require.resolve('./rules/react.js'), | ||
require.resolve('./rules/import.js'), | ||
require.resolve('./rules/promise.js'), | ||
require.resolve('./rules/react-hooks.js'), | ||
require.resolve('./rules/flowtype.js'), | ||
require.resolve('./rules/prettier.js'), | ||
], | ||
} |
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
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,26 @@ | ||
module.exports = { | ||
rules: { | ||
camelcase: 'off', | ||
curly: ['error', 'all'], | ||
eqeqeq: ['error', 'always'], | ||
radix: ['error', 'as-needed'], | ||
'arrow-body-style': 'off', | ||
'consistent-return': 'off', | ||
'global-require': 'off', | ||
'lines-between-class-members': ['error', 'always', { exceptAfterSingleLine: true }], | ||
'no-async-promise-executor': 'error', | ||
'no-await-in-loop': 'off', | ||
'no-console': ['error', { allow: ['error', 'groupCollapsed', 'groupEnd'] }], | ||
'no-else-return': 'off', | ||
'no-underscore-dangle': 'off', | ||
'no-unused-expressions': 'off', | ||
'prefer-destructuring': [ | ||
'error', | ||
{ | ||
AssignmentExpression: { array: false, object: false }, | ||
}, | ||
], | ||
'prefer-object-spread': 'off', | ||
'prefer-promise-reject-errors': ['error', { allowEmptyReject: true }], | ||
}, | ||
} |
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,46 @@ | ||
module.exports = { | ||
plugins: ['flowtype'], | ||
extends: ['plugin:flowtype/recommended'], | ||
rules: { | ||
'flowtype/array-style-complex-type': ['error', 'shorthand'], | ||
'flowtype/array-style-simple-type': ['error', 'shorthand'], | ||
'flowtype/boolean-style': ['error', 'boolean'], | ||
'flowtype/define-flow-type': 'error', | ||
'flowtype/newline-after-flow-annotation': ['error', 'never'], | ||
'flowtype/no-dupe-keys': 'error', | ||
'flowtype/no-primitive-constructor-types': 'error', | ||
'flowtype/no-types-missing-file-annotation': ['error'], | ||
'flowtype/no-unused-expressions': ['error'], | ||
'flowtype/no-weak-types': 'error', | ||
'flowtype/require-exact-type': ['error', 'always'], | ||
'flowtype/require-return-type': [ | ||
'error', | ||
'always', | ||
{ | ||
annotateUndefined: 'never', | ||
excludeArrowFunctions: 'expressionsOnly', | ||
}, | ||
], | ||
'flowtype/require-types-at-top': 'error', | ||
'flowtype/require-valid-file-annotation': [ | ||
'error', | ||
'always', | ||
{ | ||
annotationStyle: 'line', | ||
}, | ||
], | ||
'flowtype/type-id-match': ['error', '^([A-Z]+[a-z0-9A-Z]*)$'], | ||
'flowtype/type-import-style': ['error', 'declaration'], | ||
'flowtype/use-flow-type': 'error', | ||
'flowtype/valid-syntax': 'error', | ||
// Disable stylistic rules. Prettier takes care of formatting. | ||
'flowtype/delimiter-dangle': 'off', | ||
'flowtype/generic-spacing': 'off', | ||
'flowtype/object-type-delimiter': 'off', | ||
'flowtype/semi': 'off', | ||
'flowtype/space-after-type-colon': 'off', | ||
'flowtype/space-before-generic-bracket': 'off', | ||
'flowtype/space-before-type-colon': 'off', | ||
'flowtype/union-intersection-spacing': 'off', | ||
}, | ||
} |
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,31 @@ | ||
module.exports = { | ||
plugins: ['import'], | ||
rules: { | ||
'import/default': 'error', | ||
'import/dynamic-import-chunkname': ['error'], | ||
'import/export': 'error', | ||
'import/first': 'error', | ||
'import/named': 'error', | ||
'import/namespace': ['error', { allowComputed: true }], | ||
'import/newline-after-import': 'error', | ||
'import/no-anonymous-default-export': 'error', | ||
'import/no-deprecated': 'error', | ||
'import/no-duplicates': 'error', | ||
'import/no-mutable-exports': 'error', | ||
'import/no-named-as-default': 'error', | ||
'import/no-named-as-default-member': 'error', | ||
'import/no-named-default': 'error', | ||
'import/no-self-import': 'error', | ||
'import/no-unresolved': ['error', { commonjs: true }], | ||
'import/no-unused-modules': ['error', { unusedExports: true }], | ||
'import/no-useless-path-segments': ['error', { noUselessIndex: true }], | ||
'import/order': [ | ||
'error', | ||
{ | ||
groups: [['builtin', 'external'], 'internal', ['parent', 'sibling', 'index']], | ||
'newlines-between': 'always', | ||
}, | ||
], | ||
'import/prefer-default-export': 'off', | ||
}, | ||
} |
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,15 @@ | ||
module.exports = { | ||
plugins: ['prettier'], | ||
extends: ['prettier', 'prettier/@typescript-eslint'], | ||
rules: { | ||
'prettier/prettier': [ | ||
'error', | ||
{ | ||
semi: false, | ||
trailingComma: 'es5', | ||
printWidth: 100, | ||
singleQuote: true, | ||
}, | ||
], | ||
}, | ||
} |
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,11 @@ | ||
module.exports = { | ||
plugins: ['promise'], | ||
rules: { | ||
'promise/catch-or-return': 'error', | ||
'promise/no-callback-in-promise': 'error', | ||
'promise/no-nesting': 'error', | ||
'promise/no-return-in-finally': 'error', | ||
'promise/no-return-wrap': 'error', | ||
'promise/param-names': 'error', | ||
}, | ||
} |
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,7 @@ | ||
module.exports = { | ||
plugins: ['react-hooks'], | ||
rules: { | ||
'react-hooks/rules-of-hooks': 'error', | ||
'react-hooks/exhaustive-deps': 'error', | ||
}, | ||
} |
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,20 @@ | ||
module.exports = { | ||
plugins: ['react'], | ||
extends: ['plugin:react/recommended'], | ||
rules: { | ||
'react/destructuring-assignment': 'off', | ||
// override this rule if using extension .jsx or .tsx | ||
'react/jsx-filename-extension': ['error', { extensions: ['.js'] }], | ||
'react/jsx-props-no-spreading': 'off', | ||
'react/no-danger': 'off', | ||
'react/prop-types': 'off', | ||
'react/require-default-props': 'off', | ||
// Disable stylistic rules. Prettier takes care of formatting. | ||
'react/jsx-wrap-multilines': 'off', | ||
'react/jsx-indent': 'off', | ||
'react/jsx-one-expression-per-line': 'off', | ||
'react/jsx-curly-newline': 'off', | ||
'react/display-name': 'off', | ||
'react/forbid-foreign-prop-types': 'off', | ||
}, | ||
} |
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,31 @@ | ||
module.exports = { | ||
plugins: ['@typescript-eslint'], | ||
extends: [ | ||
'airbnb', | ||
'plugin:@typescript-eslint/recommended', | ||
require.resolve('./rules/eslint.js'), | ||
require.resolve('./rules/react.js'), | ||
require.resolve('./rules/import.js'), | ||
require.resolve('./rules/promise.js'), | ||
require.resolve('./rules/react-hooks.js'), | ||
require.resolve('./rules/prettier.js'), | ||
], | ||
rules: { | ||
'react/jsx-filename-extension': ['error', { extensions: ['.tsx'] }], | ||
// Todo: investigate why eslint fails for typescript when | ||
// turn on below prop | ||
'import/no-unused-modules': 'off', | ||
}, | ||
settings: { | ||
react: { | ||
pragma: 'React', | ||
version: 'detect', | ||
}, | ||
'import/resolver': { | ||
node: { | ||
extensions: ['.ts', '.tsx'], | ||
}, | ||
}, | ||
}, | ||
parser: '@typescript-eslint/parser', | ||
} |
Oops, something went wrong.