eslint-config-seek 0.0.0-typescript-config-20221028024455
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/.eslintrc.js +216 -0
- package/LICENSE +21 -0
- package/README.md +32 -0
- package/package.json +54 -0
package/.eslintrc.js
ADDED
|
@@ -0,0 +1,216 @@
|
|
|
1
|
+
const path = require('path');
|
|
2
|
+
const root = require('find-root')(process.cwd());
|
|
3
|
+
|
|
4
|
+
const OFF = 0;
|
|
5
|
+
const ERROR = 2;
|
|
6
|
+
|
|
7
|
+
const baseRules = {
|
|
8
|
+
// Possible Errors
|
|
9
|
+
'no-console': ERROR,
|
|
10
|
+
'no-unexpected-multiline': ERROR,
|
|
11
|
+
'block-scoped-var': ERROR,
|
|
12
|
+
curly: [ERROR, 'all'],
|
|
13
|
+
'default-case': ERROR,
|
|
14
|
+
'dot-notation': ERROR,
|
|
15
|
+
eqeqeq: [ERROR, 'always', { null: 'ignore' }],
|
|
16
|
+
'guard-for-in': ERROR,
|
|
17
|
+
'no-alert': ERROR,
|
|
18
|
+
'no-caller': ERROR,
|
|
19
|
+
'no-div-regex': ERROR,
|
|
20
|
+
'no-else-return': ERROR,
|
|
21
|
+
'no-eval': ERROR,
|
|
22
|
+
'no-extend-native': ERROR,
|
|
23
|
+
'no-extra-bind': ERROR,
|
|
24
|
+
'no-floating-decimal': ERROR,
|
|
25
|
+
'no-implicit-coercion': ERROR,
|
|
26
|
+
'no-implied-eval': ERROR,
|
|
27
|
+
'no-iterator': ERROR,
|
|
28
|
+
'no-labels': ERROR,
|
|
29
|
+
'no-lone-blocks': ERROR,
|
|
30
|
+
'no-loop-func': ERROR,
|
|
31
|
+
'no-multi-str': ERROR,
|
|
32
|
+
'no-new-func': ERROR,
|
|
33
|
+
'no-new-wrappers': ERROR,
|
|
34
|
+
'no-new': ERROR,
|
|
35
|
+
'no-octal-escape': ERROR,
|
|
36
|
+
'no-param-reassign': ERROR,
|
|
37
|
+
'no-proto': ERROR,
|
|
38
|
+
'no-return-assign': ERROR,
|
|
39
|
+
'no-script-url': ERROR,
|
|
40
|
+
'no-self-compare': ERROR,
|
|
41
|
+
'no-sequences': ERROR,
|
|
42
|
+
'no-throw-literal': ERROR,
|
|
43
|
+
'no-useless-call': ERROR,
|
|
44
|
+
'no-void': ERROR,
|
|
45
|
+
radix: ERROR,
|
|
46
|
+
'vars-on-top': ERROR,
|
|
47
|
+
yoda: ERROR,
|
|
48
|
+
strict: [ERROR, 'never'],
|
|
49
|
+
'no-label-var': ERROR,
|
|
50
|
+
'no-shadow': ERROR,
|
|
51
|
+
'no-undef-init': ERROR,
|
|
52
|
+
'no-unused-vars': [
|
|
53
|
+
ERROR,
|
|
54
|
+
{ argsIgnorePattern: '^_', ignoreRestSiblings: true },
|
|
55
|
+
],
|
|
56
|
+
'handle-callback-err': ERROR,
|
|
57
|
+
'no-new-require': ERROR,
|
|
58
|
+
'no-path-concat': ERROR,
|
|
59
|
+
'no-process-exit': ERROR,
|
|
60
|
+
'no-restricted-modules': ERROR,
|
|
61
|
+
'no-sync': ERROR,
|
|
62
|
+
'linebreak-style': [ERROR, 'unix'],
|
|
63
|
+
'new-cap': ERROR,
|
|
64
|
+
'no-lonely-if': ERROR,
|
|
65
|
+
'no-nested-ternary': ERROR,
|
|
66
|
+
'no-unneeded-ternary': ERROR,
|
|
67
|
+
'spaced-comment': [ERROR, 'always'],
|
|
68
|
+
'no-var': ERROR,
|
|
69
|
+
'object-shorthand': ERROR,
|
|
70
|
+
'prefer-const': ERROR,
|
|
71
|
+
'prefer-spread': ERROR,
|
|
72
|
+
'prefer-template': ERROR,
|
|
73
|
+
// Allow devs to choose between performance and richer stack traces
|
|
74
|
+
// https://eslint.org/docs/rules/no-return-await#when-not-to-use-it
|
|
75
|
+
// https://github.com/goldbergyoni/nodebestpractices/blob/master@%7B2022-01-01T00:00:00Z%7D/sections/errorhandling/returningpromises.md
|
|
76
|
+
'no-return-await': OFF,
|
|
77
|
+
};
|
|
78
|
+
|
|
79
|
+
const reactRules = {
|
|
80
|
+
'react/prefer-es6-class': [ERROR, 'always'],
|
|
81
|
+
'react/self-closing-comp': ERROR,
|
|
82
|
+
'react/jsx-pascal-case': ERROR,
|
|
83
|
+
'react-hooks/rules-of-hooks': ERROR,
|
|
84
|
+
'react-hooks/exhaustive-deps': ERROR,
|
|
85
|
+
'react/no-children-prop': ERROR,
|
|
86
|
+
'react/display-name': OFF,
|
|
87
|
+
'react/prop-types': OFF,
|
|
88
|
+
};
|
|
89
|
+
|
|
90
|
+
/** @type {import('eslint').Linter.Config} */
|
|
91
|
+
const baseConfig = {
|
|
92
|
+
parser: '@babel/eslint-parser',
|
|
93
|
+
parserOptions: {
|
|
94
|
+
babelOptions: {
|
|
95
|
+
presets: ['@babel/preset-react'],
|
|
96
|
+
},
|
|
97
|
+
requireConfigFile: false,
|
|
98
|
+
sourceType: 'module',
|
|
99
|
+
},
|
|
100
|
+
root: true,
|
|
101
|
+
env: {
|
|
102
|
+
browser: true,
|
|
103
|
+
node: true,
|
|
104
|
+
},
|
|
105
|
+
settings: {
|
|
106
|
+
react: {
|
|
107
|
+
version: 'detect',
|
|
108
|
+
},
|
|
109
|
+
},
|
|
110
|
+
plugins: ['react', 'react-hooks', 'import'],
|
|
111
|
+
extends: [
|
|
112
|
+
'plugin:react/recommended',
|
|
113
|
+
// this config enables eslint-plugin-import to resolve JavaScript and TypeScript files
|
|
114
|
+
// https://github.com/import-js/eslint-plugin-import/blob/v2.26.0/config/typescript.js
|
|
115
|
+
// Some rules provided by eslint-plugin-import e.g. `import/no-duplicates` don't work without it
|
|
116
|
+
'plugin:import/typescript',
|
|
117
|
+
'prettier',
|
|
118
|
+
],
|
|
119
|
+
rules: {
|
|
120
|
+
...baseRules,
|
|
121
|
+
...reactRules,
|
|
122
|
+
},
|
|
123
|
+
overrides: [
|
|
124
|
+
{
|
|
125
|
+
// TypeScript config
|
|
126
|
+
files: ['**/*.ts', '**/*.tsx'],
|
|
127
|
+
parser: '@typescript-eslint/parser',
|
|
128
|
+
parserOptions: {
|
|
129
|
+
ecmaVersion: 2018,
|
|
130
|
+
sourceType: 'module',
|
|
131
|
+
},
|
|
132
|
+
extends: [
|
|
133
|
+
'plugin:@typescript-eslint/eslint-recommended',
|
|
134
|
+
'plugin:@typescript-eslint/recommended',
|
|
135
|
+
'prettier',
|
|
136
|
+
],
|
|
137
|
+
settings: {
|
|
138
|
+
// adds comprehensive TypeScript support to eslint-plugin-import
|
|
139
|
+
// https://github.com/import-js/eslint-import-resolver-typescript
|
|
140
|
+
'import/resolver': {
|
|
141
|
+
typescript: {},
|
|
142
|
+
},
|
|
143
|
+
},
|
|
144
|
+
rules: {
|
|
145
|
+
'@typescript-eslint/no-unused-expressions': ERROR,
|
|
146
|
+
'@typescript-eslint/no-unused-vars': [
|
|
147
|
+
ERROR,
|
|
148
|
+
{ argsIgnorePattern: '^_', ignoreRestSiblings: true },
|
|
149
|
+
],
|
|
150
|
+
'@typescript-eslint/no-use-before-define': OFF,
|
|
151
|
+
'@typescript-eslint/no-non-null-assertion': OFF,
|
|
152
|
+
'@typescript-eslint/ban-ts-comment': OFF,
|
|
153
|
+
'@typescript-eslint/no-explicit-any': OFF,
|
|
154
|
+
'@typescript-eslint/explicit-function-return-type': OFF,
|
|
155
|
+
'@typescript-eslint/no-empty-function': OFF,
|
|
156
|
+
'@typescript-eslint/no-empty-interface': OFF,
|
|
157
|
+
'@typescript-eslint/no-inferrable-types': [
|
|
158
|
+
ERROR,
|
|
159
|
+
{ ignoreParameters: true },
|
|
160
|
+
],
|
|
161
|
+
// prefer TypeScript exhaustiveness checking
|
|
162
|
+
// https://www.typescriptlang.org/docs/handbook/advanced-types.html#exhaustiveness-checking
|
|
163
|
+
'default-case': OFF,
|
|
164
|
+
'arrow-body-style': [ERROR, 'as-needed'],
|
|
165
|
+
// Use `typescript-eslint`'s no-shadow to avoid false positives with enums
|
|
166
|
+
// https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/no-shadow.md
|
|
167
|
+
'no-shadow': OFF,
|
|
168
|
+
'@typescript-eslint/no-shadow': ERROR,
|
|
169
|
+
},
|
|
170
|
+
},
|
|
171
|
+
{
|
|
172
|
+
// JavaScript config
|
|
173
|
+
files: ['**/*.js', '**/*.jsx'],
|
|
174
|
+
env: {
|
|
175
|
+
es6: true,
|
|
176
|
+
},
|
|
177
|
+
extends: ['plugin:import/errors', 'plugin:import/warnings'],
|
|
178
|
+
settings: {
|
|
179
|
+
'import/resolver': {
|
|
180
|
+
node: {
|
|
181
|
+
moduleDirectory: [root, path.join(root, 'node_modules')],
|
|
182
|
+
},
|
|
183
|
+
},
|
|
184
|
+
},
|
|
185
|
+
rules: {
|
|
186
|
+
'no-use-before-define': [ERROR, { functions: false }],
|
|
187
|
+
'no-unused-expressions': ERROR,
|
|
188
|
+
'import/no-unresolved': [
|
|
189
|
+
ERROR,
|
|
190
|
+
{ commonjs: true, amd: true, ignore: ['.svg$', '^file?'] },
|
|
191
|
+
],
|
|
192
|
+
'import/no-duplicates': ERROR,
|
|
193
|
+
},
|
|
194
|
+
},
|
|
195
|
+
{
|
|
196
|
+
// Jest config
|
|
197
|
+
files: ['**/__tests__/**/*.{js,ts,tsx}', '**/*.@(spec|test).{js,ts,tsx}'],
|
|
198
|
+
env: {
|
|
199
|
+
jest: true,
|
|
200
|
+
},
|
|
201
|
+
extends: ['plugin:jest/recommended'],
|
|
202
|
+
plugins: ['jest'],
|
|
203
|
+
},
|
|
204
|
+
{
|
|
205
|
+
// Cypress config
|
|
206
|
+
files: ['cypress/**/*.{js,ts,tsx}'],
|
|
207
|
+
env: {
|
|
208
|
+
'cypress/globals': true,
|
|
209
|
+
},
|
|
210
|
+
extends: ['plugin:cypress/recommended'],
|
|
211
|
+
plugins: ['cypress'],
|
|
212
|
+
},
|
|
213
|
+
],
|
|
214
|
+
};
|
|
215
|
+
|
|
216
|
+
module.exports = baseConfig;
|
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2019 SEEK
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
[](https://github.com/seek-oss/eslint-config-seek/actions/workflows/test.yml)
|
|
2
|
+
[](https://github.com/seek-oss/eslint-config-seek/actions/workflows/release.yml)
|
|
3
|
+
|
|
4
|
+
# eslint-config-seek
|
|
5
|
+
|
|
6
|
+
This package includes the shareable ESLint configuration used by [SEEK](https://github.com/seek-oss/).
|
|
7
|
+
|
|
8
|
+
## Usage in sku Projects
|
|
9
|
+
|
|
10
|
+
The easiest way to use this configuration is with [sku](https://github.com/seek-oss/sku), which includes it by default.
|
|
11
|
+
|
|
12
|
+
**You don’t need to install it separately in sku projects.**
|
|
13
|
+
|
|
14
|
+
## Usage Outside of sku
|
|
15
|
+
|
|
16
|
+
If you want to use this ESLint configuration in a project not built with sku, you can install it with following steps.
|
|
17
|
+
|
|
18
|
+
First, install this package, ESLint and the necessary plugins listed in this project's [package.json](package.json).
|
|
19
|
+
|
|
20
|
+
Then create a file named `.eslintrc` with following contents in the root folder of your project:
|
|
21
|
+
|
|
22
|
+
```js
|
|
23
|
+
{
|
|
24
|
+
"extends": "seek"
|
|
25
|
+
}
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
You can override the settings from `eslint-config-seek` by editing the `.eslintrc` file. Learn more about [configuring ESLint](http://eslint.org/docs/user-guide/configuring) on the ESLint website.
|
|
29
|
+
|
|
30
|
+
## License
|
|
31
|
+
|
|
32
|
+
MIT.
|
package/package.json
ADDED
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "eslint-config-seek",
|
|
3
|
+
"version": "0.0.0-typescript-config-20221028024455",
|
|
4
|
+
"description": "ESLint configuration used by SEEK",
|
|
5
|
+
"main": ".eslintrc.js",
|
|
6
|
+
"files": [
|
|
7
|
+
".eslintrc.js"
|
|
8
|
+
],
|
|
9
|
+
"repository": {
|
|
10
|
+
"type": "git",
|
|
11
|
+
"url": "https://github.com/seek-oss/eslint-config-seek.git"
|
|
12
|
+
},
|
|
13
|
+
"author": "SEEK",
|
|
14
|
+
"license": "MIT",
|
|
15
|
+
"bugs": {
|
|
16
|
+
"url": "https://github.com/seek-oss/eslint-config-seek/issues"
|
|
17
|
+
},
|
|
18
|
+
"homepage": "https://github.com/seek-oss/eslint-config-seek#readme",
|
|
19
|
+
"dependencies": {
|
|
20
|
+
"@babel/core": "^7.19.6",
|
|
21
|
+
"@babel/eslint-parser": "^7.19.1",
|
|
22
|
+
"@babel/preset-react": "^7.18.6",
|
|
23
|
+
"@typescript-eslint/eslint-plugin": "^5.41.0",
|
|
24
|
+
"@typescript-eslint/parser": "^5.41.0",
|
|
25
|
+
"eslint-config-prettier": "^8.5.0",
|
|
26
|
+
"eslint-import-resolver-typescript": "3.5.2",
|
|
27
|
+
"eslint-plugin-cypress": "^2.12.1",
|
|
28
|
+
"eslint-plugin-import": "^2.26.0",
|
|
29
|
+
"eslint-plugin-jest": "^27.1.3",
|
|
30
|
+
"eslint-plugin-react": "^7.31.10",
|
|
31
|
+
"eslint-plugin-react-hooks": "^4.6.0",
|
|
32
|
+
"find-root": "^1.1.0"
|
|
33
|
+
},
|
|
34
|
+
"devDependencies": {
|
|
35
|
+
"@changesets/cli": "2.25.0",
|
|
36
|
+
"@changesets/get-github-info": "0.5.1",
|
|
37
|
+
"eslint": "8.26.0",
|
|
38
|
+
"prettier": "2.7.1",
|
|
39
|
+
"typescript": "^4.8.4"
|
|
40
|
+
},
|
|
41
|
+
"peerDependencies": {
|
|
42
|
+
"eslint": ">=6",
|
|
43
|
+
"typescript": ">=3.3"
|
|
44
|
+
},
|
|
45
|
+
"packageManager": "pnpm@7.14.0",
|
|
46
|
+
"volta": {
|
|
47
|
+
"node": "16.18.0"
|
|
48
|
+
},
|
|
49
|
+
"scripts": {
|
|
50
|
+
"release": "changeset publish",
|
|
51
|
+
"test": "eslint .",
|
|
52
|
+
"changeset-version": "changeset version && prettier --write ."
|
|
53
|
+
}
|
|
54
|
+
}
|