@oriflame/config-eslint 4.2.3 → 5.0.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +1 -1
- package/README.md +2 -81
- package/dts/index.d.ts +10 -0
- package/lib/index.js +45 -40
- package/lib/index.js.map +1 -0
- package/package.json +37 -30
- package/src/index.ts +21 -27
- package/CHANGELOG.md +0 -3605
- package/lib/index.d.ts +0 -10
- package/lib/index.d.ts.map +0 -1
- package/lib/presets/SECRET_CONFIG_DO_NOT_USE_THIS.d.ts +0 -4
- package/lib/presets/SECRET_CONFIG_DO_NOT_USE_THIS.d.ts.map +0 -1
- package/lib/presets/SECRET_CONFIG_DO_NOT_USE_THIS.js +0 -32
- package/lib/presets/base.d.ts +0 -4
- package/lib/presets/base.d.ts.map +0 -1
- package/lib/presets/base.js +0 -120
- package/lib/presets/future.d.ts +0 -4
- package/lib/presets/future.d.ts.map +0 -1
- package/lib/presets/future.js +0 -13
- package/lib/presets/nextjs.d.ts +0 -4
- package/lib/presets/nextjs.d.ts.map +0 -1
- package/lib/presets/nextjs.js +0 -13
- package/lib/presets/node.d.ts +0 -4
- package/lib/presets/node.d.ts.map +0 -1
- package/lib/presets/node.js +0 -26
- package/lib/presets/prettier.d.ts +0 -4
- package/lib/presets/prettier.d.ts.map +0 -1
- package/lib/presets/prettier.js +0 -13
- package/lib/presets/typescript.d.ts +0 -4
- package/lib/presets/typescript.d.ts.map +0 -1
- package/lib/presets/typescript.js +0 -40
- package/lib/resolvers/graphql.d.ts +0 -6
- package/lib/resolvers/graphql.d.ts.map +0 -1
- package/lib/resolvers/graphql.js +0 -12
- package/lib/rules/a11y.d.ts +0 -4
- package/lib/rules/a11y.d.ts.map +0 -1
- package/lib/rules/a11y.js +0 -45
- package/lib/rules/eslint-comments.d.ts +0 -4
- package/lib/rules/eslint-comments.d.ts.map +0 -1
- package/lib/rules/eslint-comments.js +0 -14
- package/lib/rules/eslint.d.ts +0 -4
- package/lib/rules/eslint.d.ts.map +0 -1
- package/lib/rules/eslint.js +0 -385
- package/lib/rules/import.d.ts +0 -4
- package/lib/rules/import.d.ts.map +0 -1
- package/lib/rules/import.js +0 -76
- package/lib/rules/jest.d.ts +0 -4
- package/lib/rules/jest.d.ts.map +0 -1
- package/lib/rules/jest.js +0 -59
- package/lib/rules/nextjs.d.ts +0 -4
- package/lib/rules/nextjs.d.ts.map +0 -1
- package/lib/rules/nextjs.js +0 -17
- package/lib/rules/node.d.ts +0 -4
- package/lib/rules/node.d.ts.map +0 -1
- package/lib/rules/node.js +0 -45
- package/lib/rules/prettier.d.ts +0 -4
- package/lib/rules/prettier.d.ts.map +0 -1
- package/lib/rules/prettier.js +0 -6
- package/lib/rules/promise.d.ts +0 -4
- package/lib/rules/promise.d.ts.map +0 -1
- package/lib/rules/promise.js +0 -24
- package/lib/rules/react-hooks.d.ts +0 -4
- package/lib/rules/react-hooks.d.ts.map +0 -1
- package/lib/rules/react-hooks.js +0 -7
- package/lib/rules/react.d.ts +0 -4
- package/lib/rules/react.d.ts.map +0 -1
- package/lib/rules/react.js +0 -143
- package/lib/rules/testing-library.d.ts +0 -4
- package/lib/rules/testing-library.d.ts.map +0 -1
- package/lib/rules/testing-library.js +0 -31
- package/lib/rules/typescript.d.ts +0 -4
- package/lib/rules/typescript.d.ts.map +0 -1
- package/lib/rules/typescript.js +0 -369
- package/lib/rules/unicorn.d.ts +0 -4
- package/lib/rules/unicorn.d.ts.map +0 -1
- package/lib/rules/unicorn.js +0 -105
- package/src/presets/SECRET_CONFIG_DO_NOT_USE_THIS.ts +0 -34
- package/src/presets/base.ts +0 -143
- package/src/presets/future.ts +0 -13
- package/src/presets/nextjs.ts +0 -13
- package/src/presets/node.ts +0 -27
- package/src/presets/prettier.ts +0 -13
- package/src/presets/typescript.ts +0 -45
- package/src/resolvers/graphql.ts +0 -11
- package/src/rules/a11y.ts +0 -47
- package/src/rules/eslint-comments.ts +0 -16
- package/src/rules/eslint.ts +0 -384
- package/src/rules/import.ts +0 -79
- package/src/rules/jest.ts +0 -64
- package/src/rules/nextjs.ts +0 -19
- package/src/rules/node.ts +0 -47
- package/src/rules/prettier.ts +0 -8
- package/src/rules/promise.ts +0 -26
- package/src/rules/react-hooks.ts +0 -9
- package/src/rules/react.ts +0 -145
- package/src/rules/testing-library.ts +0 -33
- package/src/rules/typescript.ts +0 -377
- package/src/rules/unicorn.ts +0 -108
- package/test/index.test.ts +0 -81
- package/test/lint-files/combo.ts +0 -10
- package/test/lint-files/errors/combo.ts +0 -3
- package/test/lint-files/errors/javascript.js +0 -2
- package/test/lint-files/errors/next.js +0 -11
- package/test/lint-files/errors/node.js +0 -3
- package/test/lint-files/errors/prettier.js +0 -5
- package/test/lint-files/errors/test.js +0 -3
- package/test/lint-files/errors/typescript.ts +0 -3
- package/test/lint-files/javascript.js +0 -1
- package/test/lint-files/next.js +0 -5
- package/test/lint-files/node.js +0 -2
- package/test/lint-files/prettier.js +0 -1
- package/test/lint-files/test.js +0 -5
- package/test/lint-files/typescript.ts +0 -20
- package/test/tsconfig.json +0 -19
- package/test/utils/getErrors.ts +0 -16
- package/tools/check-rules/allRules.ts +0 -99
- package/tools/check-rules/index.ts +0 -90
- package/tools/check-rules/tsconfig.json +0 -17
- package/tsconfig.json +0 -22
- package/tsconfig.tsbuildinfo +0 -1
package/src/rules/promise.ts
DELETED
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
import { ESLintConfig } from '@beemo/driver-eslint';
|
|
2
|
-
|
|
3
|
-
const config: ESLintConfig['rules'] = {
|
|
4
|
-
// eslint-plugin-promise rules
|
|
5
|
-
'promise/always-return': 'off', // return inside each then() to create readable and reusable Promise chains.
|
|
6
|
-
'promise/avoid-new': 'off', // avoid creating new promises outside of utility libs (use pify instead)
|
|
7
|
-
'promise/catch-or-return': 'off', // enforces the use of catch() on un-returned promises
|
|
8
|
-
'promise/no-callback-in-promise': 'error', // avoid calling cb() inside of a then() (use nodeify instead)
|
|
9
|
-
'promise/no-native': 'off', // in an ES5 environment, make sure to create a Promise constructor before using.
|
|
10
|
-
'promise/no-nesting': 'warn', // avoid nested then() or catch() statements
|
|
11
|
-
'promise/no-new-statics': 'error', // avoid calling new on a Promise static method
|
|
12
|
-
'promise/no-promise-in-callback': 'error', // avoid using promises inside of callbacks
|
|
13
|
-
'promise/no-return-in-finally': 'error', // disallow return statements in finally()
|
|
14
|
-
'promise/no-return-wrap': [
|
|
15
|
-
'error',
|
|
16
|
-
{
|
|
17
|
-
allowReject: true,
|
|
18
|
-
},
|
|
19
|
-
], // avoid wrapping values in Promise.resolve or Promise.reject when not needed
|
|
20
|
-
'promise/param-names': 'error', // enforce consistent param names and ordering when creating new promises.
|
|
21
|
-
'promise/prefer-await-to-callbacks': 'off', // prefer async/await to the callback pattern
|
|
22
|
-
'promise/prefer-await-to-then': 'off', // prefer await to then() for reading Promise values
|
|
23
|
-
'promise/valid-params': 'error', // ensures the proper number of arguments are passed to Promise functions
|
|
24
|
-
};
|
|
25
|
-
|
|
26
|
-
export = config;
|
package/src/rules/react-hooks.ts
DELETED
package/src/rules/react.ts
DELETED
|
@@ -1,145 +0,0 @@
|
|
|
1
|
-
import { ESLintConfig } from '@beemo/driver-eslint';
|
|
2
|
-
|
|
3
|
-
const config: ESLintConfig['rules'] = {
|
|
4
|
-
// eslint-plugin-react rules
|
|
5
|
-
'react/boolean-prop-naming': 'off', // enforces consistent naming for boolean props
|
|
6
|
-
'react/button-has-type': ['error', { reset: false }], // forbid "button" element without an explicit "type" attribute
|
|
7
|
-
'react/default-props-match-prop-types': 'error', // enforce all defaultProps are defined and not "required" in propTypes
|
|
8
|
-
'react/destructuring-assignment': 'warn', // rule enforces consistent usage of destructuring assignment in component
|
|
9
|
-
'react/display-name': 'off', // prevent missing displayName in a React component definition
|
|
10
|
-
'react/forbid-component-props': 'off', // forbid certain props on Components
|
|
11
|
-
'react/forbid-dom-props': 'off', // forbid certain props on DOM Nodes
|
|
12
|
-
'react/forbid-elements': 'off', // forbid certain elements
|
|
13
|
-
'react/forbid-foreign-prop-types': 'error', // forbid using another component's propTypes
|
|
14
|
-
'react/forbid-prop-types': [
|
|
15
|
-
'error',
|
|
16
|
-
{
|
|
17
|
-
forbid: ['any', 'array', 'object'],
|
|
18
|
-
checkContextTypes: true,
|
|
19
|
-
checkChildContextTypes: true,
|
|
20
|
-
},
|
|
21
|
-
], // forbid certain propTypes
|
|
22
|
-
'react/function-component-definition': 'off', // standardize the way function component get defined
|
|
23
|
-
'react/jsx-boolean-value': ['error', 'never'], // enforce boolean attributes notation in JSX
|
|
24
|
-
'react/jsx-child-element-spacing': 'error', // ensures inline tags are not rendered without spaces between them
|
|
25
|
-
'react/jsx-closing-bracket-location': 'off', // validate closing bracket location in JSX
|
|
26
|
-
'react/jsx-closing-tag-location': 'off', // validate closing tag location for multiline JSX
|
|
27
|
-
'react/jsx-curly-brace-presence': ['error', { props: 'never', children: 'never' }], // disallow unnecessary JSX expressions when literals alone are sufficient or enforce JSX expressions on literals in JSX children or attributes
|
|
28
|
-
'react/jsx-curly-newline': 'off', // enforce consistent line breaks inside jsx curly
|
|
29
|
-
'react/jsx-curly-spacing': 'off', // enforce or disallow spaces inside of curly braces in JSX attributes and expressions
|
|
30
|
-
'react/jsx-equals-spacing': 'off', // disallow or enforce spaces around equal signs in JSX attributes
|
|
31
|
-
'react/jsx-filename-extension': ['error', { allow: 'as-needed', extensions: ['.jsx', '.tsx'] }], // restrict file extensions that may contain JSX
|
|
32
|
-
'react/jsx-first-prop-new-line': 'off', // ensure proper position of the first property in JSX
|
|
33
|
-
'react/jsx-fragments': ['error', 'syntax'], // enforce shorthand or standard form for React fragments
|
|
34
|
-
'react/jsx-handler-names': 'error', // enforce event handler naming conventions in JSX
|
|
35
|
-
'react/jsx-indent': 'off', // validate JSX indentation
|
|
36
|
-
'react/jsx-indent-props': 'off', // validate props indentation in JSX
|
|
37
|
-
'react/jsx-key': 'error', // report missing key props in iterators/collection literals
|
|
38
|
-
'react/jsx-max-depth': 'off', // validate JSX maximum depth
|
|
39
|
-
'react/jsx-max-props-per-line': 'off', // limit maximum of props on a single line in JSX
|
|
40
|
-
'react/jsx-newline': 'off', // enforce a new line after jsx elements and expressions
|
|
41
|
-
'react/jsx-no-bind': ['warn', { ignoreDOMComponents: true }], // prevents usage of Function.prototype.bind and arrow functions in React component props
|
|
42
|
-
'react/jsx-no-constructed-context-values': 'warn', // prevents JSX context provider values from taking values that will cause needless rerenders
|
|
43
|
-
'react/jsx-no-comment-textnodes': 'warn', // comments inside children section of tag should be placed inside braces
|
|
44
|
-
'react/jsx-no-duplicate-props': ['error', { ignoreCase: true }], // enforce no duplicate props
|
|
45
|
-
'react/jsx-no-literals': 'off', // Prevent usage of string literals in JSX
|
|
46
|
-
'react/jsx-no-script-url': 'error', // forbid javascript: URLs
|
|
47
|
-
'react/jsx-no-target-blank': 'error', // forbid target="_blank" attribute without rel="noreferrer"
|
|
48
|
-
'react/jsx-no-undef': 'error', // disallow undeclared variables in JSX
|
|
49
|
-
'react/jsx-no-useless-fragment': 'error', // disallow unnecessary fragments
|
|
50
|
-
'react/jsx-one-expression-per-line': 'off', // Limit to one expression per line in JSX
|
|
51
|
-
'react/jsx-pascal-case': 'error', // enforce PascalCase for user-defined JSX components
|
|
52
|
-
'react/jsx-props-no-multi-spaces': 'off', // disallow multiple spaces between inline JSX props
|
|
53
|
-
'react/jsx-props-no-spreading': 'off', // prevent JSX prop spreading
|
|
54
|
-
'react/jsx-sort-default-props': 'off', // enforce default props alphabetical sorting
|
|
55
|
-
'react/jsx-sort-props': [
|
|
56
|
-
'warn',
|
|
57
|
-
{
|
|
58
|
-
callbacksLast: true,
|
|
59
|
-
shorthandFirst: true,
|
|
60
|
-
noSortAlphabetically: true,
|
|
61
|
-
reservedFirst: true,
|
|
62
|
-
},
|
|
63
|
-
], // enforce props alphabetical sorting
|
|
64
|
-
'react/jsx-tag-spacing': 'off', // validate whitespace in and around the JSX opening and closing brackets
|
|
65
|
-
'react/jsx-uses-react': 'off', // prevent React to be incorrectly marked as unused
|
|
66
|
-
'react/jsx-uses-vars': 'error', // prevent variables used in JSX to be incorrectly marked as unused
|
|
67
|
-
'react/jsx-wrap-multilines': 'off', // prevent missing parentheses around multilines JSX
|
|
68
|
-
'react/no-access-state-in-setstate': 'error', // reports when this.state is accessed within setState
|
|
69
|
-
'react/no-adjacent-inline-elements': 'off', // prevent adjacent inline elements not separated by whitespace
|
|
70
|
-
'react/no-array-index-key': 'error', // prevent usage of Array index in keys
|
|
71
|
-
'react/no-children-prop': 'error', // prevent passing of children as props
|
|
72
|
-
'react/no-danger': 'warn', // prevent usage of dangerous JSX props
|
|
73
|
-
'react/no-danger-with-children': 'error', // report when a DOM element is using both children and dangerouslySetInnerHTML
|
|
74
|
-
'react/no-deprecated': 'error', // prevent usage of deprecated methods, including component lifecycle methods
|
|
75
|
-
'react/no-did-mount-set-state': 'error', // prevent usage of setState in componentDidMount
|
|
76
|
-
'react/no-did-update-set-state': 'error', // prevent usage of setState in componentDidUpdate
|
|
77
|
-
'react/no-direct-mutation-state': 'error', // prevent direct mutation of this.state
|
|
78
|
-
'react/no-find-dom-node': 'error', // prevent usage of findDOMNode
|
|
79
|
-
'react/no-is-mounted': 'error', // prevent usage of isMounted
|
|
80
|
-
'react/no-multi-comp': 'off', // prevent multiple component definition per file
|
|
81
|
-
'react/no-redundant-should-component-update': 'error', // flag shouldComponentUpdate when extending PureComponent
|
|
82
|
-
'react/no-render-return-value': 'error', // prevent usage of the return value of React.render
|
|
83
|
-
'react/no-set-state': 'off', // prevent usage of setState
|
|
84
|
-
'react/no-string-refs': 'error', // prevent string definitions for references and prevent referencing this.refs
|
|
85
|
-
'react/no-this-in-sfc': 'error', // report "this" being used in stateless components
|
|
86
|
-
'react/no-typos': 'error', // prevent common casing typos
|
|
87
|
-
'react/no-unescaped-entities': 'error', // detect unescaped HTML entities, which might represent malformed tags
|
|
88
|
-
'react/no-unknown-property': 'warn', // prevent usage of unknown DOM property
|
|
89
|
-
'react/no-unsafe': 'error', // prevent usage of unsafe lifecycle methods
|
|
90
|
-
'react/no-unstable-nested-components': 'error', // prevent creating unstable components inside components
|
|
91
|
-
'react/no-unused-prop-types': 'off', // prevent definitions of unused prop types
|
|
92
|
-
'react/no-unused-state': 'error', // prevent definitions of unused state fields
|
|
93
|
-
'react/no-will-update-set-state': 'error', // prevent usage of setState in componentWillUpdate
|
|
94
|
-
'react/prefer-es6-class': 'error', // enforce ES5 or ES6 class for React Components
|
|
95
|
-
'react/prefer-read-only-props': 'off', // require read-only props
|
|
96
|
-
'react/prefer-stateless-function': 'error', // enforce stateless React Components to be written as a pure function
|
|
97
|
-
'react/react-in-jsx-scope': 'off', // prevent missing React when using JSX
|
|
98
|
-
'react/require-default-props': 'off', // enforce a defaultProps definition for every prop that is not a required prop
|
|
99
|
-
'react/require-optimization': 'off', // enforce React components to have a shouldComponentUpdate method
|
|
100
|
-
'react/require-render-return': 'error', // enforce ES5 or ES6 class for returning value in render function
|
|
101
|
-
'react/self-closing-comp': 'error', // prevent extra closing tags for components without children
|
|
102
|
-
'react/sort-comp': [
|
|
103
|
-
'warn',
|
|
104
|
-
{
|
|
105
|
-
order: ['statics', 'properties', 'lifecycle', 'everything-else', 'handlers', 'renderers'],
|
|
106
|
-
groups: {
|
|
107
|
-
statics: ['propTypes', 'defaultProps', 'contextType', 'contextTypes', 'childContextTypes'],
|
|
108
|
-
properties: ['/^(?!on).+$/', '/^(?!handle).+$/', '/^(?!render).+$/', '/^.+Ref$/', 'state'],
|
|
109
|
-
lifecycle: [
|
|
110
|
-
'constructor',
|
|
111
|
-
'getDerivedStateFromProps',
|
|
112
|
-
'componentWillMount',
|
|
113
|
-
'UNSAFE_componentWillMount',
|
|
114
|
-
'componentDidMount',
|
|
115
|
-
'componentWillReceiveProps',
|
|
116
|
-
'UNSAFE_componentWillReceiveProps',
|
|
117
|
-
'shouldComponentUpdate',
|
|
118
|
-
'componentWillUpdate',
|
|
119
|
-
'UNSAFE_componentWillUpdate',
|
|
120
|
-
'getSnapshotBeforeUpdate',
|
|
121
|
-
'componentDidUpdate',
|
|
122
|
-
'componentDidCatch',
|
|
123
|
-
'componentWillUnmount',
|
|
124
|
-
],
|
|
125
|
-
handlers: ['/^on.+$/', '/^handle.+$/'],
|
|
126
|
-
renderers: ['/^render.+$/', 'render'],
|
|
127
|
-
},
|
|
128
|
-
},
|
|
129
|
-
], // enforce component methods order
|
|
130
|
-
'react/sort-prop-types': [
|
|
131
|
-
'warn',
|
|
132
|
-
{
|
|
133
|
-
ignoreCase: true,
|
|
134
|
-
callbacksLast: true,
|
|
135
|
-
requiredFirst: false,
|
|
136
|
-
sortShapeProp: true,
|
|
137
|
-
},
|
|
138
|
-
], // enforce propTypes declarations alphabetical sorting
|
|
139
|
-
'react/state-in-constructor': ['warn', 'never'], // state initialization in an ES6 class component should be in a constructor
|
|
140
|
-
'react/static-property-placement': 'off', // defines where React component static properties should be positioned
|
|
141
|
-
'react/style-prop-object': 'warn', // enforce style prop value is an object
|
|
142
|
-
'react/void-dom-elements-no-children': 'error', // prevent passing of children to void DOM elements (e.g. <br />)
|
|
143
|
-
};
|
|
144
|
-
|
|
145
|
-
export = config;
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
import { ESLintConfig } from '@beemo/driver-eslint';
|
|
2
|
-
|
|
3
|
-
const config: ESLintConfig['rules'] = {
|
|
4
|
-
// eslint-plugin-testing-library
|
|
5
|
-
'testing-library/await-async-query': 'error', // enforce async queries to have proper await
|
|
6
|
-
'testing-library/await-async-utils': 'error', // enforce async utils to be awaited properly
|
|
7
|
-
'testing-library/await-fire-event': 'off', // enforce async fire event methods to be awaited
|
|
8
|
-
'testing-library/consistent-data-testid': 'off', // ensure data-testid values match a provided regex
|
|
9
|
-
'testing-library/no-await-sync-events': 'error', // disallow unnecessary await for sync events
|
|
10
|
-
'testing-library/no-await-sync-query': 'error', // disallow unnecessary await for sync queries
|
|
11
|
-
'testing-library/no-container': 'warn', // disallow the use of container methods
|
|
12
|
-
'testing-library/no-debugging-utils': 'warn', // disallow the use of debug
|
|
13
|
-
'testing-library/no-dom-import': ['error', 'react'], // disallow importing from DOM Testing Library
|
|
14
|
-
'testing-library/no-manual-cleanup': 'off', // disallow the use of cleanup
|
|
15
|
-
'testing-library/no-node-access': 'error', // disallow direct Node access
|
|
16
|
-
'testing-library/no-promise-in-fire-event': 'error', // disallow the use of promises passed to a fireEvent method
|
|
17
|
-
'testing-library/no-render-in-setup': 'off', // disallow the use of render in setup functions
|
|
18
|
-
'testing-library/no-unnecessary-act': 'error', // disallow wrapping Testing Library utils or empty callbacks in act
|
|
19
|
-
'testing-library/no-wait-for-empty-callback': 'off', // disallow empty callbacks for waitFor and waitForElementToBeRemoved
|
|
20
|
-
'testing-library/no-wait-for-multiple-assertions': 'warn', // disallow the use of multiple expect inside waitFor
|
|
21
|
-
'testing-library/no-wait-for-side-effects': 'warn', // disallow the use of side effects inside waitFor
|
|
22
|
-
'testing-library/no-wait-for-snapshot': 'warn', // ensures no snapshot is generated inside of a waitFor call
|
|
23
|
-
'testing-library/prefer-explicit-assert': 'warn', // suggest using explicit assertions rather than just getBy* queries
|
|
24
|
-
'testing-library/prefer-find-by': 'warn', // suggest using findBy* methods instead of the waitFor + getBy queries
|
|
25
|
-
'testing-library/prefer-presence-queries': 'off', // enforce specific queries when checking element is present or not
|
|
26
|
-
'testing-library/prefer-query-by-disappearance': 'warn', // suggest using queryBy* queries when waiting for disappearance
|
|
27
|
-
'testing-library/prefer-user-event': 'warn', // suggest using userEvent library instead of fireEvent for simulating user interaction
|
|
28
|
-
'testing-library/prefer-screen-queries': 'off', // suggest using screen while using queries
|
|
29
|
-
'testing-library/prefer-wait-for': 'error', // use waitFor instead of deprecated wait methods
|
|
30
|
-
'testing-library/render-result-naming-convention': 'warn', // enforce a valid naming for return value from render
|
|
31
|
-
};
|
|
32
|
-
|
|
33
|
-
export = config;
|
package/src/rules/typescript.ts
DELETED
|
@@ -1,377 +0,0 @@
|
|
|
1
|
-
/* eslint-disable id-denylist -- we have to use identifiers like "String" in rule definitions */
|
|
2
|
-
|
|
3
|
-
import { ESLintConfig } from '@beemo/driver-eslint';
|
|
4
|
-
import { TJSX_EXTS_GROUP } from '@oriflame/lumos-common';
|
|
5
|
-
|
|
6
|
-
const config: ESLintConfig['rules'] = {
|
|
7
|
-
// override ESLint rules
|
|
8
|
-
camelcase: 'off', // enforce camelcase naming convention
|
|
9
|
-
'default-param-last': 'off', // enforce default parameters to be last
|
|
10
|
-
'dot-notation': 'off', // enforce dot notation whenever possible
|
|
11
|
-
'lines-between-class-members': 'off', // require or disallow an empty line between class members
|
|
12
|
-
'no-array-constructor': 'off', // disallow Array constructors
|
|
13
|
-
'no-dupe-class-members': 'off', // disallow duplicate class members
|
|
14
|
-
'no-duplicate-imports': 'off', // disallow duplicate module imports
|
|
15
|
-
'no-empty-function': 'off', // disallow empty functions
|
|
16
|
-
'no-implied-eval': 'off', // disallow the use of eval()-like methods
|
|
17
|
-
'no-invalid-this': 'off', // disallow this keywords outside of classes or class-like objects
|
|
18
|
-
'no-loop-func': 'off', // disallow function declarations and expressions inside loop statements
|
|
19
|
-
'no-loss-of-precision': 'off', // disallow literal numbers that lose precision
|
|
20
|
-
'no-magic-numbers': 'off', // disallow magic numbers
|
|
21
|
-
'no-redeclare': 'off', // disallow variable redeclaration
|
|
22
|
-
'no-shadow': 'off', // disallow variable declarations from shadowing variables declared in the outer scope
|
|
23
|
-
'no-throw-literal': 'off', // disallow throwing literals as exceptions
|
|
24
|
-
'no-return-await': 'off', // disallow unnecessary return await
|
|
25
|
-
'no-undef': 'off', // disallow the use of undeclared variables unless mentioned in /* global */ comments
|
|
26
|
-
'no-underscore-dangle': 'off', // disallow dangling underscores in identifiers
|
|
27
|
-
'no-unused-expressions': 'off', // disallow unused expressions
|
|
28
|
-
'no-unused-vars': 'off', // disallow unused variables
|
|
29
|
-
'no-use-before-define': 'off', // disallow the use of variables before they are defined
|
|
30
|
-
'no-useless-constructor': 'off', // disallow unnecessary constructors
|
|
31
|
-
quotes: 'off', // enforce the consistent use of either backticks, double, or single quotes
|
|
32
|
-
'require-await': 'off', // disallow async functions which have no await expression
|
|
33
|
-
'space-infix-ops': 'off', // require spacing around infix operators
|
|
34
|
-
|
|
35
|
-
// override eslint-plugin-node rules
|
|
36
|
-
'node/file-extension-in-import': [
|
|
37
|
-
'error',
|
|
38
|
-
'always',
|
|
39
|
-
{ '.js': 'never', '.jsx': 'never', '.ts': 'never', '.tsx': 'never' },
|
|
40
|
-
], // enforce the style of file extensions in import declarations
|
|
41
|
-
'node/no-missing-import': 'off', // disallow import declarations which import non-existence modules
|
|
42
|
-
|
|
43
|
-
// override eslint-plugin-react rules
|
|
44
|
-
'react/forbid-prop-types': 'off', // forbid certain propTypes
|
|
45
|
-
'react/forbid-foreign-prop-types': 'off', // forbid using another component's propTypes
|
|
46
|
-
'react/no-unused-prop-types': 'off', // prevent definitions of unused prop types
|
|
47
|
-
'react/prop-types': 'off', // prevent missing props validation in a React component definition
|
|
48
|
-
'react/sort-prop-types': 'off', // enforce propTypes declarations alphabetical sorting
|
|
49
|
-
|
|
50
|
-
// override eslint-plugin-import rules
|
|
51
|
-
'import/extensions': [
|
|
52
|
-
'error',
|
|
53
|
-
'always',
|
|
54
|
-
{ js: 'never', jsx: 'never', ts: 'never', tsx: 'never' },
|
|
55
|
-
], // ensure consistent use of file extension within the import path
|
|
56
|
-
'import/no-extraneous-dependencies': [
|
|
57
|
-
'error',
|
|
58
|
-
{
|
|
59
|
-
devDependencies: [
|
|
60
|
-
`test/**/*.${TJSX_EXTS_GROUP}`,
|
|
61
|
-
`tests/**/*.${TJSX_EXTS_GROUP}`,
|
|
62
|
-
`**/*.test.${TJSX_EXTS_GROUP}`,
|
|
63
|
-
`__tests__/**/*.${TJSX_EXTS_GROUP}`,
|
|
64
|
-
`**/__tests__/**/*.${TJSX_EXTS_GROUP}`,
|
|
65
|
-
`**/jest.config.${TJSX_EXTS_GROUP}`,
|
|
66
|
-
`**/webpack.config.${TJSX_EXTS_GROUP}`,
|
|
67
|
-
`**/webpack.config.*.${TJSX_EXTS_GROUP}`,
|
|
68
|
-
`tools/**/*.${TJSX_EXTS_GROUP}`,
|
|
69
|
-
],
|
|
70
|
-
optionalDependencies: false,
|
|
71
|
-
},
|
|
72
|
-
],
|
|
73
|
-
|
|
74
|
-
// @typescript-eslint/eslint-plugin rules
|
|
75
|
-
'@typescript-eslint/adjacent-overload-signatures': 'error', // require that member overloads be consecutive
|
|
76
|
-
'@typescript-eslint/array-type': ['error', { default: 'array-simple' }], // requires using either T[] or Array<T> for arrays
|
|
77
|
-
'@typescript-eslint/await-thenable': 'error', // disallows awaiting a value that is not a Thenable
|
|
78
|
-
'@typescript-eslint/ban-ts-comment': 'warn', // bans // @ts-<directive> comments from being used
|
|
79
|
-
'@typescript-eslint/ban-tslint-comment': 'error', // bans // tslint:<rule-flag> comments from being used
|
|
80
|
-
'@typescript-eslint/ban-types': [
|
|
81
|
-
'error',
|
|
82
|
-
{
|
|
83
|
-
types: {
|
|
84
|
-
Function:
|
|
85
|
-
"Don't use Function as a type. Use explicit types like `(...args: any[]) => void`.",
|
|
86
|
-
String: { message: 'Use string instead.', fixWith: 'string' },
|
|
87
|
-
},
|
|
88
|
-
},
|
|
89
|
-
], // bans specific types from being used
|
|
90
|
-
'@typescript-eslint/brace-style': 'off', // enforce consistent brace style for blocks
|
|
91
|
-
'@typescript-eslint/class-literal-property-style': 'off', // ensures that literals on classes are exposed in a consistent style
|
|
92
|
-
'@typescript-eslint/consistent-indexed-object-style': 'off', // enforce or disallow the use of the record type
|
|
93
|
-
'@typescript-eslint/comma-dangle': 'off', // require or disallow trailing comma
|
|
94
|
-
'@typescript-eslint/comma-spacing': 'off', // enforces consistent spacing before and after commas
|
|
95
|
-
'@typescript-eslint/consistent-type-assertions': [
|
|
96
|
-
'error',
|
|
97
|
-
{
|
|
98
|
-
assertionStyle: 'as',
|
|
99
|
-
objectLiteralTypeAssertions: 'allow-as-parameter',
|
|
100
|
-
},
|
|
101
|
-
], // enforces consistent usage of type assertions
|
|
102
|
-
'@typescript-eslint/consistent-type-definitions': ['warn', 'interface'], // consistent with type definition either interface or type
|
|
103
|
-
'@typescript-eslint/consistent-type-imports': 'off', // enforces consistent usage of type imports
|
|
104
|
-
'@typescript-eslint/default-param-last': 'warn', // enforce default parameters to be last
|
|
105
|
-
'@typescript-eslint/dot-notation': ['error', { allowKeywords: true }], // enforce dot notation whenever possible
|
|
106
|
-
'@typescript-eslint/explicit-function-return-type': 'off', // require explicit return types on functions and class methods
|
|
107
|
-
'@typescript-eslint/explicit-member-accessibility': ['warn', { accessibility: 'no-public' }], // require explicit accessibility modifiers on class properties and methods
|
|
108
|
-
'@typescript-eslint/explicit-module-boundary-types': 'off', // require explicit return and argument types on exported functions' and classes' public class methods
|
|
109
|
-
'@typescript-eslint/func-call-spacing': 'off', // require or disallow spacing between function identifiers and their invocations
|
|
110
|
-
'@typescript-eslint/indent': 'off', // enforce consistent indentation
|
|
111
|
-
'@typescript-eslint/init-declarations': 'off', // require or disallow initialization in variable declarations
|
|
112
|
-
'@typescript-eslint/keyword-spacing': 'off', // enforce consistent spacing before and after keywords
|
|
113
|
-
'@typescript-eslint/lines-between-class-members': [
|
|
114
|
-
'warn',
|
|
115
|
-
'always',
|
|
116
|
-
{ exceptAfterSingleLine: true },
|
|
117
|
-
], // require or disallow an empty line between class members
|
|
118
|
-
'@typescript-eslint/member-delimiter-style': 'off', // require a specific member delimiter style for interfaces and type literals
|
|
119
|
-
'@typescript-eslint/member-ordering': [
|
|
120
|
-
'warn',
|
|
121
|
-
{
|
|
122
|
-
default: {
|
|
123
|
-
memberTypes: ['field', 'constructor', 'method'],
|
|
124
|
-
order: 'as-written',
|
|
125
|
-
},
|
|
126
|
-
},
|
|
127
|
-
], // require a consistent member declaration order
|
|
128
|
-
'@typescript-eslint/method-signature-style': ['error', 'property'], // enforces using a particular method signature syntax.
|
|
129
|
-
'@typescript-eslint/naming-convention': [
|
|
130
|
-
'warn',
|
|
131
|
-
// interfaces cannot start with "I"
|
|
132
|
-
{
|
|
133
|
-
selector: 'interface',
|
|
134
|
-
format: ['PascalCase'],
|
|
135
|
-
custom: {
|
|
136
|
-
regex: '^I[A-Z]',
|
|
137
|
-
match: false,
|
|
138
|
-
},
|
|
139
|
-
},
|
|
140
|
-
// variables and parameters must use camel case, pascal case or upper case with no leading and trailing underscores - exceptions are names that are only underscores (used e.g. for placeholder parameters)
|
|
141
|
-
{
|
|
142
|
-
selector: 'variableLike',
|
|
143
|
-
format: ['camelCase', 'PascalCase', 'UPPER_CASE'],
|
|
144
|
-
leadingUnderscore: 'forbid',
|
|
145
|
-
trailingUnderscore: 'forbid',
|
|
146
|
-
filter: {
|
|
147
|
-
regex: '^(_+|__webpack_public_path__)$',
|
|
148
|
-
match: false,
|
|
149
|
-
},
|
|
150
|
-
},
|
|
151
|
-
// functions must use camel case or pascal case with no leading and trailing underscores
|
|
152
|
-
{
|
|
153
|
-
selector: 'function',
|
|
154
|
-
format: ['camelCase', 'PascalCase'],
|
|
155
|
-
leadingUnderscore: 'forbid',
|
|
156
|
-
trailingUnderscore: 'forbid',
|
|
157
|
-
},
|
|
158
|
-
/* TODO [@jakubmazanec]: enable this when we can discern things defined in external packages and other stuff - {
|
|
159
|
-
selector: 'variable',
|
|
160
|
-
types: ['boolean'],
|
|
161
|
-
format: ['PascalCase'],
|
|
162
|
-
prefix: [
|
|
163
|
-
'is',
|
|
164
|
-
'are',
|
|
165
|
-
'was',
|
|
166
|
-
'should',
|
|
167
|
-
'has',
|
|
168
|
-
'can',
|
|
169
|
-
'does',
|
|
170
|
-
'did',
|
|
171
|
-
'will',
|
|
172
|
-
'use',
|
|
173
|
-
'allow',
|
|
174
|
-
],
|
|
175
|
-
leadingUnderscore: 'forbid',
|
|
176
|
-
trailingUnderscore: 'forbid',
|
|
177
|
-
},
|
|
178
|
-
// this allows destructured boolean variable names to retain their original name
|
|
179
|
-
{
|
|
180
|
-
selector: 'variable',
|
|
181
|
-
types: ['boolean'],
|
|
182
|
-
modifiers: ['destructured'],
|
|
183
|
-
format: null,
|
|
184
|
-
},
|
|
185
|
-
{
|
|
186
|
-
selector: 'property',
|
|
187
|
-
types: ['boolean'],
|
|
188
|
-
format: ['PascalCase'],
|
|
189
|
-
prefix: ['is', 'are', 'was', 'should', 'has', 'can', 'did', 'will', 'use', 'allow'],
|
|
190
|
-
leadingUnderscore: 'allow',
|
|
191
|
-
trailingUnderscore: 'forbid',
|
|
192
|
-
},
|
|
193
|
-
{
|
|
194
|
-
selector: 'parameterProperty',
|
|
195
|
-
types: ['boolean'],
|
|
196
|
-
format: ['PascalCase'],
|
|
197
|
-
prefix: [
|
|
198
|
-
'is',
|
|
199
|
-
'are',
|
|
200
|
-
'was',
|
|
201
|
-
'should',
|
|
202
|
-
'has',
|
|
203
|
-
'can',
|
|
204
|
-
'does',
|
|
205
|
-
'did',
|
|
206
|
-
'will',
|
|
207
|
-
'use',
|
|
208
|
-
'allow',
|
|
209
|
-
],
|
|
210
|
-
leadingUnderscore: 'forbid',
|
|
211
|
-
trailingUnderscore: 'forbid',
|
|
212
|
-
},
|
|
213
|
-
{
|
|
214
|
-
selector: 'accessor',
|
|
215
|
-
types: ['boolean'],
|
|
216
|
-
format: ['PascalCase'],
|
|
217
|
-
prefix: [
|
|
218
|
-
'is',
|
|
219
|
-
'are',
|
|
220
|
-
'was',
|
|
221
|
-
'should',
|
|
222
|
-
'has',
|
|
223
|
-
'can',
|
|
224
|
-
'does',
|
|
225
|
-
'did',
|
|
226
|
-
'will',
|
|
227
|
-
'use',
|
|
228
|
-
'allow',
|
|
229
|
-
],
|
|
230
|
-
leadingUnderscore: 'forbid',
|
|
231
|
-
trailingUnderscore: 'forbid',
|
|
232
|
-
}, */
|
|
233
|
-
// "member-like" (i.e. properties, methods, etc.) must use camel case, pascal case or upper case with only leading underscore allowed
|
|
234
|
-
{
|
|
235
|
-
selector: 'memberLike',
|
|
236
|
-
format: ['camelCase', 'PascalCase', 'UPPER_CASE'],
|
|
237
|
-
leadingUnderscore: 'allow',
|
|
238
|
-
trailingUnderscore: 'forbid',
|
|
239
|
-
filter: {
|
|
240
|
-
regex: '__typename', // don't check GraphQL specific properties
|
|
241
|
-
match: false,
|
|
242
|
-
},
|
|
243
|
-
},
|
|
244
|
-
// "type-like" (i.e. interface, enum, etc.) must use pascal case
|
|
245
|
-
{
|
|
246
|
-
selector: 'typeLike',
|
|
247
|
-
format: ['PascalCase'],
|
|
248
|
-
},
|
|
249
|
-
], // enforces naming conventions for everything across a codebase
|
|
250
|
-
'@typescript-eslint/no-base-to-string': 'off', // requires that .toString() is only called on objects which provide useful information when stringified
|
|
251
|
-
'@typescript-eslint/no-array-constructor': 'error', // disallow generic Array constructors
|
|
252
|
-
'@typescript-eslint/no-confusing-non-null-assertion': 'off', // disallow non-null assertion in locations that may be confusing
|
|
253
|
-
'@typescript-eslint/no-confusing-void-expression': [
|
|
254
|
-
'warn',
|
|
255
|
-
{
|
|
256
|
-
ignoreArrowShorthand: true,
|
|
257
|
-
ignoreVoidOperator: true,
|
|
258
|
-
},
|
|
259
|
-
], // requires expressions of type void to appear in statement position
|
|
260
|
-
'@typescript-eslint/no-dupe-class-members': 'error', // disallow duplicate class members
|
|
261
|
-
'@typescript-eslint/no-duplicate-imports': 'error', // disallow duplicate imports
|
|
262
|
-
'@typescript-eslint/no-dynamic-delete': 'off', // bans usage of the delete operator with computed key expressions
|
|
263
|
-
'@typescript-eslint/no-empty-function': 'off', // disallow empty functions
|
|
264
|
-
'@typescript-eslint/no-empty-interface': 'warn', // disallow the declaration of empty interfaces
|
|
265
|
-
'@typescript-eslint/no-explicit-any': ['error', { fixToUnknown: true }], // disallow usage of the any type
|
|
266
|
-
'@typescript-eslint/no-extra-non-null-assertion': 'warn', // disallow extra non-null assertion
|
|
267
|
-
'@typescript-eslint/no-extra-parens': 'off', // disallow unnecessary parentheses
|
|
268
|
-
'@typescript-eslint/no-extra-semi': 'off', // disallow unnecessary semicolons
|
|
269
|
-
'@typescript-eslint/no-extraneous-class': [
|
|
270
|
-
'warn',
|
|
271
|
-
{
|
|
272
|
-
allowConstructorOnly: true,
|
|
273
|
-
allowEmpty: false,
|
|
274
|
-
allowStaticOnly: true,
|
|
275
|
-
},
|
|
276
|
-
], // forbids the use of classes as namespaces
|
|
277
|
-
'@typescript-eslint/no-floating-promises': 'off', // requires Promise-like values to be handled appropriately
|
|
278
|
-
'@typescript-eslint/no-for-in-array': 'error', // disallow iterating over an array with a for-in loop
|
|
279
|
-
'@typescript-eslint/no-implicit-any-catch': 'error', // disallow usage of the implicit any type in catch clauses
|
|
280
|
-
'@typescript-eslint/no-implied-eval': 'error', // disallow the use of eval()-like methods
|
|
281
|
-
'@typescript-eslint/no-inferrable-types': [
|
|
282
|
-
'error',
|
|
283
|
-
{ ignoreParameters: false, ignoreProperties: false },
|
|
284
|
-
], // disallows explicit type declarations for variables or parameters initialized to a number, string, or boolean
|
|
285
|
-
'@typescript-eslint/no-invalid-this': 'warn', // disallow this keywords outside of classes or class-like objects
|
|
286
|
-
'@typescript-eslint/no-invalid-void-type': 'warn', // disallows usage of void type outside of generic or return types
|
|
287
|
-
'@typescript-eslint/no-loop-func': 'warn', // disallow function declarations that contain unsafe references inside loop statements
|
|
288
|
-
'@typescript-eslint/no-loss-of-precision': 'warn', // disallow literal numbers that lose precision
|
|
289
|
-
'@typescript-eslint/no-magic-numbers': 'off', // disallows magic numbers
|
|
290
|
-
'@typescript-eslint/no-misused-new': 'error', // enforce valid definition of new and constructor
|
|
291
|
-
'@typescript-eslint/no-misused-promises': ['error'], // avoid using promises in places not designed to handle them
|
|
292
|
-
'@typescript-eslint/no-namespace': 'warn', // disallow the use of custom TypeScript modules and namespaces
|
|
293
|
-
'@typescript-eslint/no-non-null-asserted-optional-chain': 'error', // disallows using a non-null assertion after an optional chain expression
|
|
294
|
-
'@typescript-eslint/no-non-null-assertion': 'warn', // disallows non-null assertions using the ! postfix operator
|
|
295
|
-
'@typescript-eslint/no-parameter-properties': 'error', // disallow the use of parameter properties in class constructors
|
|
296
|
-
'@typescript-eslint/no-redeclare': 'error', // disallow variable redeclaration
|
|
297
|
-
'@typescript-eslint/no-require-imports': 'error', // disallows invocation of require()
|
|
298
|
-
'@typescript-eslint/no-shadow': ['warn', { allow: ['resolve, reject'] }], // disallow variable declarations from shadowing variables declared in the outer scope
|
|
299
|
-
'@typescript-eslint/no-this-alias': 'warn', // disallow aliasing this
|
|
300
|
-
'@typescript-eslint/no-throw-literal': 'error', // disallow throwing literals as exceptions
|
|
301
|
-
'@typescript-eslint/no-type-alias': 'off', // disallow the use of type aliases
|
|
302
|
-
'@typescript-eslint/no-unnecessary-boolean-literal-compare': 'error', // flags unnecessary equality comparisons against boolean literals
|
|
303
|
-
'@typescript-eslint/no-unnecessary-condition': ['error', { allowConstantLoopConditions: true }], // prevents conditionals where the type is always truthy or always falsy
|
|
304
|
-
'@typescript-eslint/no-unnecessary-qualifier': 'error', // warns when a namespace qualifier is unnecessary
|
|
305
|
-
'@typescript-eslint/no-unnecessary-type-arguments': 'error', // warns if an explicitly specified type argument is the default for that type parameter
|
|
306
|
-
'@typescript-eslint/no-unnecessary-type-assertion': 'error', // warns if a type assertion does not change the type of an expression
|
|
307
|
-
'@typescript-eslint/no-unnecessary-type-constraint': 'warn', // disallows unnecessary constraints on generic types
|
|
308
|
-
'@typescript-eslint/no-unsafe-argument': 'error', // disallows calling an function with an any type value
|
|
309
|
-
'@typescript-eslint/no-unsafe-assignment': 'error', // disallows assigning any to variables and properties
|
|
310
|
-
'@typescript-eslint/no-unsafe-call': 'error', // disallows calling an any type value
|
|
311
|
-
'@typescript-eslint/no-unsafe-member-access': 'error', // disallows member access on any typed variables
|
|
312
|
-
'@typescript-eslint/no-unsafe-return': 'error', // disallows returning any from a function
|
|
313
|
-
'@typescript-eslint/no-unused-expressions': 'error', // disallow unused expressions
|
|
314
|
-
'@typescript-eslint/no-unused-vars': [
|
|
315
|
-
'error',
|
|
316
|
-
{ vars: 'all', args: 'none', ignoreRestSiblings: true },
|
|
317
|
-
], // disallow unused variables
|
|
318
|
-
'@typescript-eslint/no-use-before-define': [
|
|
319
|
-
'error',
|
|
320
|
-
{
|
|
321
|
-
functions: false,
|
|
322
|
-
},
|
|
323
|
-
], // disallow the use of variables before they are defined
|
|
324
|
-
'@typescript-eslint/no-useless-constructor': 'warn', // disallow unnecessary constructors
|
|
325
|
-
'@typescript-eslint/no-var-requires': 'off', // disallows the use of require statements except in import statements
|
|
326
|
-
'@typescript-eslint/non-nullable-type-assertion-style': 'off', // prefers a non-null assertion over explicit type cast when possible
|
|
327
|
-
'@typescript-eslint/object-curly-spacing': 'off', // enforce consistent spacing inside braces
|
|
328
|
-
'@typescript-eslint/prefer-as-const': 'error', // prefer usage of as const over literal type
|
|
329
|
-
'@typescript-eslint/prefer-enum-initializers': 'off', // prefer initializing each enums member value
|
|
330
|
-
'@typescript-eslint/prefer-for-of': 'warn', // prefer a ‘for-of’ loop over a standard ‘for’ loop if the index is only used to access the array being iterated
|
|
331
|
-
'@typescript-eslint/prefer-function-type': 'warn', // Use function types instead of interfaces with call signatures
|
|
332
|
-
'@typescript-eslint/prefer-includes': 'warn', // enforce includes method over indexOf method
|
|
333
|
-
'@typescript-eslint/prefer-literal-enum-member': 'warn', // require that all enum members be literal values to prevent unintended enum member name shadow issues
|
|
334
|
-
'@typescript-eslint/prefer-namespace-keyword': 'error', // require the use of the namespace keyword instead of the module keyword to declare custom TypeScript modules
|
|
335
|
-
'@typescript-eslint/prefer-nullish-coalescing': 'error', // enforce the usage of the nullish coalescing operator instead of logical chaining
|
|
336
|
-
'@typescript-eslint/prefer-optional-chain': 'error', // Prefer using concise optional chain expressions instead of chained logical ands
|
|
337
|
-
'@typescript-eslint/prefer-readonly': 'warn', // requires that private members are marked as readonly if they're never modified outside of the constructor
|
|
338
|
-
'@typescript-eslint/prefer-readonly-parameter-types': 'off', // requires that function parameters are typed as readonly to prevent accidental mutation of inputs
|
|
339
|
-
'@typescript-eslint/prefer-reduce-type-parameter': 'warn', // prefer using type parameter when calling Array#reduce instead of casting
|
|
340
|
-
'@typescript-eslint/prefer-regexp-exec': 'off', // prefer RegExp#exec() over String#match() if no global flag is provided
|
|
341
|
-
'@typescript-eslint/prefer-return-this-type': 'warn', // enforce that this is used when only this type is returned
|
|
342
|
-
'@typescript-eslint/prefer-string-starts-ends-with': 'off', // enforce the use of String#startsWith and String#endsWith instead of other equivalent methods of checking substrings
|
|
343
|
-
'@typescript-eslint/prefer-ts-expect-error': 'warn', // recommends using // @ts-expect-error over // @ts-ignore
|
|
344
|
-
'@typescript-eslint/promise-function-async': 'warn', // requires any function or method that returns a Promise to be marked async
|
|
345
|
-
'@typescript-eslint/quotes': [
|
|
346
|
-
'error',
|
|
347
|
-
'single',
|
|
348
|
-
{ avoidEscape: true, allowTemplateLiterals: false },
|
|
349
|
-
], // enforce the consistent use of either backticks, double, or single quotes
|
|
350
|
-
'@typescript-eslint/require-array-sort-compare': 'warn', // enforce giving compare argument to Array#sort
|
|
351
|
-
'@typescript-eslint/require-await': 'error', // disallow async functions which have no await expression
|
|
352
|
-
'@typescript-eslint/restrict-plus-operands': ['error', { checkCompoundAssignments: true }], // when adding two variables, operands must both be of type number or of type string
|
|
353
|
-
'@typescript-eslint/restrict-template-expressions': 'off', // enforce template literal expressions to be of string type
|
|
354
|
-
'@typescript-eslint/return-await': 'error', // rules for awaiting returned promises
|
|
355
|
-
'@typescript-eslint/semi': 'off', // require or disallow semicolons instead of ASI
|
|
356
|
-
'@typescript-eslint/sort-type-union-intersection-members': 'warn', // enforces that members of a type union/intersection are sorted alphabetically
|
|
357
|
-
'@typescript-eslint/space-before-function-paren': 'off', // enforce consistent spacing before function definition opening parenthesis
|
|
358
|
-
'@typescript-eslint/space-infix-ops': 'off', // this rule is aimed at ensuring there are spaces around infix operators
|
|
359
|
-
'@typescript-eslint/strict-boolean-expressions': [
|
|
360
|
-
'warn',
|
|
361
|
-
{
|
|
362
|
-
allowNullableBoolean: true,
|
|
363
|
-
allowNullableString: true,
|
|
364
|
-
},
|
|
365
|
-
], // restricts the types allowed in boolean expressions
|
|
366
|
-
'@typescript-eslint/switch-exhaustiveness-check': 'error', // exhaustiveness checking in switch with union type
|
|
367
|
-
'@typescript-eslint/triple-slash-reference': [
|
|
368
|
-
'error',
|
|
369
|
-
{ path: 'never', types: 'never', lib: 'never' },
|
|
370
|
-
], // sets preference level for triple slash directives versus ES6-style import declarations
|
|
371
|
-
'@typescript-eslint/type-annotation-spacing': 'off', // require consistent spacing around type annotations
|
|
372
|
-
'@typescript-eslint/typedef': 'off', // requires type annotations to exist
|
|
373
|
-
'@typescript-eslint/unbound-method': 'off', // enforces unbound methods are called with their expected scope
|
|
374
|
-
'@typescript-eslint/unified-signatures': 'error', // warns for any two overloads that could be unified into one by using a union or an optional/rest parameter
|
|
375
|
-
};
|
|
376
|
-
|
|
377
|
-
export = config;
|