@mrpalmer/eslint-config 1.0.1 → 2.0.0
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/configs/base.js +233 -0
- package/configs/jest.js +101 -0
- package/configs/react.js +154 -0
- package/configs/typescript.js +150 -0
- package/index.js +19 -339
- package/package.json +25 -25
- package/utils/packageJson.js +41 -0
- package/import.js +0 -74
- package/jest.js +0 -119
- package/jsx-a11y.js +0 -22
- package/react.js +0 -145
package/jsx-a11y.js
DELETED
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
module.exports = {
|
|
2
|
-
env: {
|
|
3
|
-
browser: true,
|
|
4
|
-
},
|
|
5
|
-
parserOptions: {
|
|
6
|
-
ecmaFeatures: {
|
|
7
|
-
jsx: true,
|
|
8
|
-
},
|
|
9
|
-
},
|
|
10
|
-
plugins: ['jsx-a11y'],
|
|
11
|
-
extends: ['plugin:jsx-a11y/recommended'],
|
|
12
|
-
rules: {
|
|
13
|
-
'jsx-a11y/alt-text': 'warn',
|
|
14
|
-
'jsx-a11y/lang': 'error',
|
|
15
|
-
'jsx-a11y/no-aria-hidden-on-focusable': 'off',
|
|
16
|
-
'jsx-a11y/no-autofocus': 'off',
|
|
17
|
-
'jsx-a11y/no-noninteractive-tabindex': 'off',
|
|
18
|
-
'jsx-a11y/no-static-element-interactions': 'off',
|
|
19
|
-
'jsx-a11y/prefer-tag-over-role': 'off',
|
|
20
|
-
'jsx-a11y/tabindex-no-positive': 'warn',
|
|
21
|
-
},
|
|
22
|
-
}
|
package/react.js
DELETED
|
@@ -1,145 +0,0 @@
|
|
|
1
|
-
const readPkgUp = require('read-pkg-up')
|
|
2
|
-
const semver = require('semver')
|
|
3
|
-
|
|
4
|
-
let oldestSupportedReactVersion = '16.5.2'
|
|
5
|
-
|
|
6
|
-
let hasPropTypes = false
|
|
7
|
-
try {
|
|
8
|
-
const pkg = readPkgUp.sync({ normalize: true })
|
|
9
|
-
// eslint-disable-next-line prefer-object-spread
|
|
10
|
-
const allDeps = Object.assign(
|
|
11
|
-
{ react: '16.5.2' },
|
|
12
|
-
pkg.peerDependencies,
|
|
13
|
-
pkg.devDependencies,
|
|
14
|
-
pkg.dependencies
|
|
15
|
-
)
|
|
16
|
-
hasPropTypes = allDeps.hasOwnProp('prop-types')
|
|
17
|
-
oldestSupportedReactVersion = semver
|
|
18
|
-
.validRange(allDeps.react)
|
|
19
|
-
.replace(/[>=<|]/g, ' ')
|
|
20
|
-
.split(' ')
|
|
21
|
-
.filter(Boolean)
|
|
22
|
-
.sort(semver.compare)[0]
|
|
23
|
-
} catch (error) {
|
|
24
|
-
// ignore error
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
module.exports = {
|
|
28
|
-
env: {
|
|
29
|
-
browser: true,
|
|
30
|
-
},
|
|
31
|
-
parserOptions: {
|
|
32
|
-
ecmaFeatures: {
|
|
33
|
-
jsx: true,
|
|
34
|
-
},
|
|
35
|
-
},
|
|
36
|
-
plugins: ['react', 'react-hooks'],
|
|
37
|
-
extends: ['plugin:react-hooks/recommended'],
|
|
38
|
-
settings: {
|
|
39
|
-
react: {
|
|
40
|
-
version: oldestSupportedReactVersion,
|
|
41
|
-
},
|
|
42
|
-
},
|
|
43
|
-
rules: {
|
|
44
|
-
'react/boolean-prop-naming': 'off',
|
|
45
|
-
'react/button-has-type': 'off',
|
|
46
|
-
'react/checked-requires-onchange-or-readonly': 'error',
|
|
47
|
-
'react/default-props-match-prop-types': hasPropTypes ? 'error' : 'off',
|
|
48
|
-
'react/destructuring-assignment': 'off',
|
|
49
|
-
'react/display-name': ['error', { ignoreTranspilerName: false }],
|
|
50
|
-
'react/forbid-component-props': 'off',
|
|
51
|
-
'react/forbid-dom-props': 'off',
|
|
52
|
-
'react/forbid-elements': 'off',
|
|
53
|
-
'react/forbid-foreign-prop-types': hasPropTypes ? 'error' : 'off',
|
|
54
|
-
'react/forbid-prop-types': 'off',
|
|
55
|
-
'react/function-component-definition': 'off',
|
|
56
|
-
'react/hook-use-state': 'off',
|
|
57
|
-
'react/iframe-missing-sandbox': 'warn',
|
|
58
|
-
'react/jsx-boolean-value': 'off',
|
|
59
|
-
'react/jsx-curly-brace-presence': [
|
|
60
|
-
'warn',
|
|
61
|
-
{ children: 'ignore', props: 'never' },
|
|
62
|
-
],
|
|
63
|
-
'react/jsx-filename-extension': ['error', { extensions: ['.js'] }],
|
|
64
|
-
'react/jsx-fragments': 'off',
|
|
65
|
-
'react/jsx-handler-names': 'off',
|
|
66
|
-
'react/jsx-key': 'error',
|
|
67
|
-
'react/jsx-max-depth': 'off',
|
|
68
|
-
'react/jsx-no-bind': 'off',
|
|
69
|
-
'react/jsx-no-comment-textnodes': 'error',
|
|
70
|
-
'react/jsx-no-constructed-context-values': 'off',
|
|
71
|
-
'react/jsx-no-duplicate-props': 'error',
|
|
72
|
-
'react/jsx-no-leaked-render': 'off',
|
|
73
|
-
'react/jsx-no-literals': 'off',
|
|
74
|
-
'react/jsx-no-script-url': 'error',
|
|
75
|
-
'react/jsx-no-target-blank': 'error',
|
|
76
|
-
'react/jsx-no-undef': 'error',
|
|
77
|
-
'react/jsx-no-useless-fragment': 'warn',
|
|
78
|
-
'react/jsx-pascal-case': 'error',
|
|
79
|
-
'react/jsx-props-no-spread-multi': 'warn',
|
|
80
|
-
'react/jsx-props-no-spreading': 'off',
|
|
81
|
-
'react/jsx-sort-props': 'off',
|
|
82
|
-
'react/jsx-uses-react': 'error',
|
|
83
|
-
'react/jsx-uses-vars': 'error',
|
|
84
|
-
'react/no-access-state-in-setstate': 'error',
|
|
85
|
-
'react/no-adjacent-inline-elements': 'off',
|
|
86
|
-
'react/no-array-index-key': 'off', // sometimes you don't care about the issues, or they don't apply
|
|
87
|
-
'react/no-arrow-function-lifecycle': 'error',
|
|
88
|
-
'react/no-children-prop': 'off',
|
|
89
|
-
'react/no-danger': 'off',
|
|
90
|
-
'react/no-danger-with-children': 'error',
|
|
91
|
-
'react/no-deprecated': 'error',
|
|
92
|
-
'react/no-did-mount-set-state': 'error',
|
|
93
|
-
'react/no-did-update-set-state': 'error',
|
|
94
|
-
'react/no-direct-mutation-state': 'error',
|
|
95
|
-
'react/no-find-dom-node': 'error',
|
|
96
|
-
'react/no-invalid-html-attribute': 'error',
|
|
97
|
-
'react/no-is-mounted': 'error',
|
|
98
|
-
'react/no-multi-comp': 'off',
|
|
99
|
-
'react/no-namespace': 'error',
|
|
100
|
-
'react/no-object-type-as-default-prop': 'warn',
|
|
101
|
-
'react/no-redundant-should-component-update': 'error',
|
|
102
|
-
'react/no-render-return-value': 'error',
|
|
103
|
-
'react/no-set-state': 'off',
|
|
104
|
-
'react/no-string-refs': 'error',
|
|
105
|
-
'react/no-this-in-sfc': 'error',
|
|
106
|
-
'react/no-typos': 'error',
|
|
107
|
-
'react/no-unescaped-entities': 'warn',
|
|
108
|
-
'react/no-unknown-property': 'error',
|
|
109
|
-
'react/no-unsafe': 'warn', // if you need it there should be a comment explaining why
|
|
110
|
-
'react/no-unstable-nested-components': ['error', { allowAsProps: true }],
|
|
111
|
-
'react/no-unused-class-component-methods': 'error',
|
|
112
|
-
'react/no-unused-prop-types': hasPropTypes ? 'error' : 'off',
|
|
113
|
-
'react/no-unused-state': 'error',
|
|
114
|
-
'react/no-will-update-set-state': 'error',
|
|
115
|
-
'react/prefer-es6-class': 'off',
|
|
116
|
-
'react/prefer-exact-props': 'off',
|
|
117
|
-
'react/prefer-read-only-props': 'off',
|
|
118
|
-
'react/prefer-stateless-function': 'off',
|
|
119
|
-
'react/prop-types': hasPropTypes ? 'error' : 'off',
|
|
120
|
-
'react/react-in-jsx-scope': 'error',
|
|
121
|
-
'react/require-default-props': 'off', // sometimes the default value is undefined so that's fine...
|
|
122
|
-
'react/require-optimization': 'off',
|
|
123
|
-
'react/require-render-return': 'error',
|
|
124
|
-
'react/self-closing-comp': 'error',
|
|
125
|
-
'react/sort-comp': 'off',
|
|
126
|
-
'react/sort-default-props': 'off',
|
|
127
|
-
'react/sort-prop-types': 'off',
|
|
128
|
-
'react/state-in-constructor': 'off',
|
|
129
|
-
'react/static-property-placement': 'off',
|
|
130
|
-
'react/style-prop-object': 'error',
|
|
131
|
-
'react/void-dom-elements-no-children': 'error',
|
|
132
|
-
},
|
|
133
|
-
overrides: [
|
|
134
|
-
{
|
|
135
|
-
files: ['**/*.ts?(x)'],
|
|
136
|
-
rules: {
|
|
137
|
-
'react/jsx-filename-extension': [
|
|
138
|
-
'error',
|
|
139
|
-
{ extensions: ['.ts', '.tsx'] },
|
|
140
|
-
],
|
|
141
|
-
'react/prop-types': 'off',
|
|
142
|
-
},
|
|
143
|
-
},
|
|
144
|
-
],
|
|
145
|
-
}
|