eslint-config-seek 0.0.0-typescript-config-20221028024455 → 0.0.0-typescriptify-vitest-20251112023958

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/README.md CHANGED
@@ -5,27 +5,31 @@
5
5
 
6
6
  This package includes the shareable ESLint configuration used by [SEEK](https://github.com/seek-oss/).
7
7
 
8
- ## Usage in sku Projects
8
+ ## Usage in sku and skuba Projects
9
9
 
10
- The easiest way to use this configuration is with [sku](https://github.com/seek-oss/sku), which includes it by default.
10
+ The easiest way to use this configuration is with [sku](https://github.com/seek-oss/sku) or [skuba](https://github.com/seek-oss/skuba).
11
11
 
12
- **You don’t need to install it separately in sku projects.**
12
+ **You don’t need to install it separately in sku and skuba projects.**
13
13
 
14
- ## Usage Outside of sku
14
+ ## Usage Outside of sku and skuba
15
15
 
16
- If you want to use this ESLint configuration in a project not built with sku, you can install it with following steps.
16
+ If you want to use this ESLint configuration in a project not built with sku or skuba, you can install it with following steps.
17
17
 
18
- First, install this package, ESLint and the necessary plugins listed in this project's [package.json](package.json).
18
+ First, install this package, and the necessary peer dependencies listed in this project's [package.json](package.json).
19
19
 
20
- Then create a file named `.eslintrc` with following contents in the root folder of your project:
20
+ Then create a file named `eslint.config.js` with the following contents in the root folder of your project:
21
21
 
22
22
  ```js
23
- {
24
- "extends": "seek"
25
- }
23
+ module.exports = require('eslint-config-seek');
26
24
  ```
27
25
 
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.
26
+ The default configuration includes support for React projects. For projects that are not based on React, the "base" configuration should be used instead:
27
+
28
+ ```js
29
+ module.exports = require('eslint-config-seek/base');
30
+ ```
31
+
32
+ You can override the settings from `eslint-config-seek` by editing the `eslint.config.js` file. Learn more about [configuring ESLint](https://eslint.org/docs/latest/use/configure/) on the ESLint website.
29
33
 
30
34
  ## License
31
35
 
@@ -0,0 +1,14 @@
1
+ const require_base = require('./base-BxFQUqDk.cjs');
2
+ let __vitest_eslint_plugin = require("@vitest/eslint-plugin");
3
+ __vitest_eslint_plugin = require_base.__toESM(__vitest_eslint_plugin);
4
+
5
+ //#region src/vitest/base.ts
6
+ var base_default$1 = [...require_base.base_default, { plugins: { vitest: __vitest_eslint_plugin.default } }];
7
+
8
+ //#endregion
9
+ Object.defineProperty(exports, 'base_default', {
10
+ enumerable: true,
11
+ get: function () {
12
+ return base_default$1;
13
+ }
14
+ });
@@ -0,0 +1,263 @@
1
+ //#region rolldown:runtime
2
+ var __create = Object.create;
3
+ var __defProp = Object.defineProperty;
4
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
+ var __getOwnPropNames = Object.getOwnPropertyNames;
6
+ var __getProtoOf = Object.getPrototypeOf;
7
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
8
+ var __copyProps = (to, from, except, desc) => {
9
+ if (from && typeof from === "object" || typeof from === "function") for (var keys = __getOwnPropNames(from), i = 0, n = keys.length, key; i < n; i++) {
10
+ key = keys[i];
11
+ if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
12
+ get: ((k) => from[k]).bind(null, key),
13
+ enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
14
+ });
15
+ }
16
+ return to;
17
+ };
18
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
19
+ value: mod,
20
+ enumerable: true
21
+ }) : target, mod));
22
+
23
+ //#endregion
24
+ const require_extensions = require('./extensions-vqCxaxgq.cjs');
25
+ let eslint_plugin_import_x = require("eslint-plugin-import-x");
26
+ eslint_plugin_import_x = __toESM(eslint_plugin_import_x);
27
+ let globals = require("globals");
28
+ globals = __toESM(globals);
29
+ let eslint_plugin_cypress = require("eslint-plugin-cypress");
30
+ eslint_plugin_cypress = __toESM(eslint_plugin_cypress);
31
+ let eslint_config_prettier = require("eslint-config-prettier");
32
+ eslint_config_prettier = __toESM(eslint_config_prettier);
33
+ let typescript_eslint = require("typescript-eslint");
34
+ typescript_eslint = __toESM(typescript_eslint);
35
+
36
+ //#region src/base/base.ts
37
+ const OFF = 0;
38
+ const WARN = 1;
39
+ const ERROR = 2;
40
+ const baseRules = {
41
+ "no-console": ERROR,
42
+ "no-unexpected-multiline": ERROR,
43
+ "block-scoped-var": ERROR,
44
+ "default-case": ERROR,
45
+ "dot-notation": ERROR,
46
+ eqeqeq: [
47
+ ERROR,
48
+ "always",
49
+ { null: "ignore" }
50
+ ],
51
+ "guard-for-in": ERROR,
52
+ "no-alert": ERROR,
53
+ "no-caller": ERROR,
54
+ "no-div-regex": ERROR,
55
+ "no-else-return": ERROR,
56
+ "no-eval": ERROR,
57
+ "no-extend-native": ERROR,
58
+ "no-extra-bind": ERROR,
59
+ "no-fallthrough": ERROR,
60
+ "no-floating-decimal": ERROR,
61
+ "no-implicit-coercion": ERROR,
62
+ "no-implied-eval": ERROR,
63
+ "no-iterator": ERROR,
64
+ "no-labels": ERROR,
65
+ "no-lone-blocks": ERROR,
66
+ "no-loop-func": ERROR,
67
+ "no-multi-str": ERROR,
68
+ "no-new-func": ERROR,
69
+ "no-new-wrappers": ERROR,
70
+ "no-new": ERROR,
71
+ "no-octal-escape": ERROR,
72
+ "no-param-reassign": ERROR,
73
+ "no-proto": ERROR,
74
+ "no-return-assign": ERROR,
75
+ "no-script-url": ERROR,
76
+ "no-self-compare": ERROR,
77
+ "no-sequences": ERROR,
78
+ "no-throw-literal": ERROR,
79
+ "no-useless-call": ERROR,
80
+ "no-void": ERROR,
81
+ radix: ERROR,
82
+ "vars-on-top": ERROR,
83
+ yoda: ERROR,
84
+ strict: [ERROR, "never"],
85
+ "no-label-var": ERROR,
86
+ "no-shadow": ERROR,
87
+ "no-undef-init": ERROR,
88
+ "no-unused-vars": [ERROR, {
89
+ argsIgnorePattern: "^_",
90
+ ignoreRestSiblings: true
91
+ }],
92
+ "handle-callback-err": ERROR,
93
+ "no-new-require": ERROR,
94
+ "no-path-concat": ERROR,
95
+ "no-process-exit": ERROR,
96
+ "no-restricted-modules": ERROR,
97
+ "no-restricted-syntax": [
98
+ ERROR,
99
+ {
100
+ selector: "MethodDefinition[kind = \"get\"]",
101
+ message: "Custom getters can cause confusion, particularly if they throw errors. Remove the `get` syntax to specify a regular method instead."
102
+ },
103
+ {
104
+ selector: "MethodDefinition[kind = \"set\"]",
105
+ message: "Custom setters can cause confusion, particularly if they throw errors. Remove the `set` syntax to specify a regular method instead."
106
+ },
107
+ {
108
+ selector: "Property[kind = \"get\"]",
109
+ message: "Custom getters can cause confusion, particularly if they throw errors. Remove the `get` syntax to specify a regular property instead."
110
+ },
111
+ {
112
+ selector: "Property[kind = \"set\"]",
113
+ message: "Custom setters can cause confusion, particularly if they throw errors. Remove the `set` syntax to specify a regular property instead."
114
+ }
115
+ ],
116
+ "no-sync": ERROR,
117
+ "linebreak-style": [ERROR, "unix"],
118
+ "new-cap": ERROR,
119
+ "no-lonely-if": ERROR,
120
+ "no-nested-ternary": ERROR,
121
+ "no-unneeded-ternary": ERROR,
122
+ "spaced-comment": [ERROR, "always"],
123
+ "no-var": ERROR,
124
+ "object-shorthand": ERROR,
125
+ "prefer-const": ERROR,
126
+ "prefer-spread": ERROR,
127
+ "prefer-template": ERROR,
128
+ "no-return-await": OFF
129
+ };
130
+ const eslintConfigPrettierOverrideRules = { curly: [ERROR, "all"] };
131
+ const allExtensions = [...require_extensions.js, ...require_extensions.ts];
132
+ const settings = { "import-x/resolver": {
133
+ typescript: true,
134
+ node: true
135
+ } };
136
+ var base_default = [
137
+ { plugins: {
138
+ cypress: eslint_plugin_cypress.default,
139
+ "@typescript-eslint": typescript_eslint.default.plugin
140
+ } },
141
+ eslint_plugin_import_x.default.flatConfigs.typescript,
142
+ {
143
+ rules: eslint_plugin_import_x.default.flatConfigs.errors.rules,
144
+ files: [`**/*.{${require_extensions.js}}`]
145
+ },
146
+ {
147
+ rules: eslint_plugin_import_x.default.flatConfigs.warnings.rules,
148
+ files: [`**/*.{${require_extensions.js}}`]
149
+ },
150
+ {
151
+ languageOptions: {
152
+ globals: { ...globals.default.node },
153
+ parserOptions: {
154
+ requireConfigFile: false,
155
+ ecmaVersion: "latest",
156
+ sourceType: "module"
157
+ }
158
+ },
159
+ settings,
160
+ rules: baseRules
161
+ },
162
+ eslint_config_prettier.default,
163
+ {
164
+ languageOptions: {
165
+ globals: { ...globals.default.node },
166
+ parserOptions: {
167
+ requireConfigFile: false,
168
+ ecmaVersion: "latest",
169
+ sourceType: "module"
170
+ }
171
+ },
172
+ settings,
173
+ rules: eslintConfigPrettierOverrideRules
174
+ },
175
+ ...[...typescript_eslint.default.configs.recommended, ...typescript_eslint.default.configs.stylistic].map((config) => ({
176
+ ...config,
177
+ files: [`**/*.{${require_extensions.ts}}`]
178
+ })),
179
+ {
180
+ files: [`**/*.{${require_extensions.ts}}`],
181
+ languageOptions: {
182
+ parser: typescript_eslint.default.parser,
183
+ parserOptions: {
184
+ projectService: true,
185
+ warnOnUnsupportedTypeScriptVersion: false
186
+ }
187
+ },
188
+ settings,
189
+ rules: {
190
+ "@typescript-eslint/array-type": [ERROR, { default: "array-simple" }],
191
+ "@typescript-eslint/consistent-type-definitions": OFF,
192
+ "@typescript-eslint/no-unused-expressions": ERROR,
193
+ "@typescript-eslint/no-unused-vars": [ERROR, {
194
+ argsIgnorePattern: "^_",
195
+ ignoreRestSiblings: true
196
+ }],
197
+ "@typescript-eslint/no-use-before-define": OFF,
198
+ "@typescript-eslint/no-non-null-assertion": OFF,
199
+ "@typescript-eslint/ban-ts-comment": OFF,
200
+ "@typescript-eslint/no-explicit-any": OFF,
201
+ "@typescript-eslint/explicit-function-return-type": OFF,
202
+ "@typescript-eslint/naming-convention": [
203
+ WARN,
204
+ {
205
+ selector: "typeLike",
206
+ format: ["PascalCase"],
207
+ leadingUnderscore: "allow"
208
+ },
209
+ {
210
+ selector: "enum",
211
+ format: null
212
+ }
213
+ ],
214
+ "@typescript-eslint/no-empty-function": OFF,
215
+ "@typescript-eslint/no-empty-interface": OFF,
216
+ "@typescript-eslint/no-inferrable-types": [ERROR, { ignoreParameters: true }],
217
+ "default-case": OFF,
218
+ "arrow-body-style": [ERROR, "as-needed"],
219
+ "no-shadow": OFF,
220
+ "@typescript-eslint/no-shadow": ERROR,
221
+ "@typescript-eslint/consistent-type-imports": [ERROR, { fixStyle: "inline-type-imports" }],
222
+ "@typescript-eslint/consistent-type-exports": [ERROR, { fixMixedExportsWithInlineTypeSpecifier: true }],
223
+ "@typescript-eslint/no-import-type-side-effects": ERROR,
224
+ "import-x/no-duplicates": [ERROR, { "prefer-inline": true }],
225
+ "import-x/export": ERROR
226
+ }
227
+ },
228
+ {
229
+ files: [`**/*.{${require_extensions.js}}`],
230
+ languageOptions: { globals: {} },
231
+ settings,
232
+ rules: {
233
+ "no-undef": ERROR,
234
+ "no-use-before-define": [ERROR, { functions: false }],
235
+ "no-unused-expressions": ERROR,
236
+ "import-x/no-unresolved": [ERROR, {
237
+ commonjs: true,
238
+ amd: true,
239
+ ignore: [".svg$", "^file?"]
240
+ }],
241
+ "import-x/no-duplicates": ERROR,
242
+ "import-x/export": ERROR
243
+ }
244
+ },
245
+ {
246
+ ...eslint_plugin_cypress.default.configs.recommended,
247
+ files: [`**/cypress/**/*.{${allExtensions}}`]
248
+ }
249
+ ];
250
+
251
+ //#endregion
252
+ Object.defineProperty(exports, '__toESM', {
253
+ enumerable: true,
254
+ get: function () {
255
+ return __toESM;
256
+ }
257
+ });
258
+ Object.defineProperty(exports, 'base_default', {
259
+ enumerable: true,
260
+ get: function () {
261
+ return base_default;
262
+ }
263
+ });
package/dist/base.cjs ADDED
@@ -0,0 +1,24 @@
1
+ const require_base = require('./base-BxFQUqDk.cjs');
2
+ const require_extensions = require('./extensions-vqCxaxgq.cjs');
3
+ let globals = require("globals");
4
+ globals = require_base.__toESM(globals);
5
+ let eslint_plugin_jest = require("eslint-plugin-jest");
6
+ eslint_plugin_jest = require_base.__toESM(eslint_plugin_jest);
7
+
8
+ //#region src/base.ts
9
+ const allExtensions = [...require_extensions.js, ...require_extensions.ts];
10
+ var base_default = [
11
+ ...require_base.base_default,
12
+ { plugins: { jest: eslint_plugin_jest.default } },
13
+ {
14
+ ...eslint_plugin_jest.default.configs["flat/recommended"],
15
+ files: [`**/__tests__/**/*.{${allExtensions}}`, `**/*.@(spec|test).{${allExtensions}}`]
16
+ },
17
+ {
18
+ files: [`**/__tests__/**/*.{${allExtensions}}`, `**/*.@(spec|test).{${allExtensions}}`],
19
+ languageOptions: { globals: { ...globals.default.jest } }
20
+ }
21
+ ];
22
+
23
+ //#endregion
24
+ module.exports = base_default;
@@ -0,0 +1,28 @@
1
+
2
+ //#region src/extensions.ts
3
+ const js = [
4
+ "js",
5
+ "cjs",
6
+ "mjs",
7
+ "jsx"
8
+ ];
9
+ const ts = [
10
+ "ts",
11
+ "cts",
12
+ "mts",
13
+ "tsx"
14
+ ];
15
+
16
+ //#endregion
17
+ Object.defineProperty(exports, 'js', {
18
+ enumerable: true,
19
+ get: function () {
20
+ return js;
21
+ }
22
+ });
23
+ Object.defineProperty(exports, 'ts', {
24
+ enumerable: true,
25
+ get: function () {
26
+ return ts;
27
+ }
28
+ });
@@ -0,0 +1,4 @@
1
+ const require_extensions = require('./extensions-vqCxaxgq.cjs');
2
+
3
+ exports.js = require_extensions.js;
4
+ exports.ts = require_extensions.ts;
package/dist/index.cjs ADDED
@@ -0,0 +1,9 @@
1
+ const require_base = require('./base-BxFQUqDk.cjs');
2
+ require('./extensions-vqCxaxgq.cjs');
3
+ const require_react = require('./react-Civ_tFVV.cjs');
4
+
5
+ //#region src/index.ts
6
+ var src_default = [...require_base.base_default, ...require_react.react_default];
7
+
8
+ //#endregion
9
+ module.exports = src_default;
@@ -0,0 +1,55 @@
1
+ const require_base = require('./base-BxFQUqDk.cjs');
2
+ let globals = require("globals");
3
+ globals = require_base.__toESM(globals);
4
+ let eslint_plugin_react = require("eslint-plugin-react");
5
+ eslint_plugin_react = require_base.__toESM(eslint_plugin_react);
6
+ let eslint_plugin_react_hooks = require("eslint-plugin-react-hooks");
7
+ eslint_plugin_react_hooks = require_base.__toESM(eslint_plugin_react_hooks);
8
+
9
+ //#region src/base/react.ts
10
+ const OFF = 0;
11
+ const ERROR = 2;
12
+ const reactRules = {
13
+ "react/prefer-es6-class": [ERROR, "always"],
14
+ "react/self-closing-comp": ERROR,
15
+ "react/jsx-pascal-case": ERROR,
16
+ "react-hooks/rules-of-hooks": ERROR,
17
+ "react-hooks/exhaustive-deps": ERROR,
18
+ "react/no-children-prop": ERROR,
19
+ "react/display-name": OFF,
20
+ "react/prop-types": OFF,
21
+ "react/jsx-curly-brace-presence": [ERROR, {
22
+ props: "never",
23
+ children: "ignore",
24
+ propElementValues: "always"
25
+ }]
26
+ };
27
+ var react_default = [
28
+ eslint_plugin_react.default.configs.flat.recommended,
29
+ eslint_plugin_react.default.configs.flat["jsx-runtime"],
30
+ {
31
+ plugins: {
32
+ react: eslint_plugin_react.default,
33
+ "react-hooks": eslint_plugin_react_hooks.default
34
+ },
35
+ languageOptions: { globals: globals.default.browser },
36
+ settings: { react: { version: "detect" } },
37
+ rules: reactRules
38
+ },
39
+ {
40
+ files: ["**/*.tsx"],
41
+ rules: { "@typescript-eslint/no-unused-vars": [ERROR, {
42
+ argsIgnorePattern: "^_",
43
+ ignoreRestSiblings: true,
44
+ varsIgnorePattern: "^React$"
45
+ }] }
46
+ }
47
+ ];
48
+
49
+ //#endregion
50
+ Object.defineProperty(exports, 'react_default', {
51
+ enumerable: true,
52
+ get: function () {
53
+ return react_default;
54
+ }
55
+ });
@@ -0,0 +1,5 @@
1
+ require('../base-BxFQUqDk.cjs');
2
+ require('../extensions-vqCxaxgq.cjs');
3
+ const require_base$1 = require('../base-BpxGJOXX.cjs');
4
+
5
+ module.exports = require_base$1.base_default;
@@ -0,0 +1,10 @@
1
+ require('../base-BxFQUqDk.cjs');
2
+ require('../extensions-vqCxaxgq.cjs');
3
+ const require_react = require('../react-Civ_tFVV.cjs');
4
+ const require_base$1 = require('../base-BpxGJOXX.cjs');
5
+
6
+ //#region src/vitest/index.ts
7
+ var vitest_default = [...require_base$1.base_default, ...require_react.react_default];
8
+
9
+ //#endregion
10
+ module.exports = vitest_default;
package/package.json CHANGED
@@ -1,11 +1,8 @@
1
1
  {
2
2
  "name": "eslint-config-seek",
3
- "version": "0.0.0-typescript-config-20221028024455",
3
+ "version": "0.0.0-typescriptify-vitest-20251112023958",
4
+ "type": "module",
4
5
  "description": "ESLint configuration used by SEEK",
5
- "main": ".eslintrc.js",
6
- "files": [
7
- ".eslintrc.js"
8
- ],
9
6
  "repository": {
10
7
  "type": "git",
11
8
  "url": "https://github.com/seek-oss/eslint-config-seek.git"
@@ -15,40 +12,58 @@
15
12
  "bugs": {
16
13
  "url": "https://github.com/seek-oss/eslint-config-seek/issues"
17
14
  },
15
+ "main": "./dist/index.cjs",
16
+ "exports": {
17
+ ".": "./dist/index.cjs",
18
+ "./base": "./dist/base.cjs",
19
+ "./extensions": "./dist/extensions.cjs",
20
+ "./vitest": "./dist/vitest/index.cjs",
21
+ "./vitest/base": "./dist/vitest/base.cjs",
22
+ "./package.json": "./package.json"
23
+ },
24
+ "files": [
25
+ "dist"
26
+ ],
18
27
  "homepage": "https://github.com/seek-oss/eslint-config-seek#readme",
19
28
  "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"
29
+ "@vitest/eslint-plugin": "^1.4.2",
30
+ "eslint-config-prettier": "^10.0.0",
31
+ "eslint-import-resolver-typescript": "^4.0.0",
32
+ "eslint-plugin-cypress": "^5.0.0",
33
+ "eslint-plugin-import-x": "^4.9.0",
34
+ "eslint-plugin-jest": "^29.0.0",
35
+ "eslint-plugin-react": "^7.35.0",
36
+ "eslint-plugin-react-hooks": "^5.0.0",
37
+ "globals": "^16.0.0",
38
+ "typescript-eslint": "^8.6.0"
33
39
  },
34
40
  "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"
41
+ "@changesets/cli": "^2.27.7",
42
+ "@changesets/get-github-info": "^0.6.0",
43
+ "@tsconfig/node22": "^22.0.2",
44
+ "eslint": "^9.8.0",
45
+ "jiti": "^2.6.1",
46
+ "prettier": "^3.3.3",
47
+ "tsdown": "^0.16.3",
48
+ "typescript": "~5.9.0"
40
49
  },
41
50
  "peerDependencies": {
42
- "eslint": ">=6",
43
- "typescript": ">=3.3"
51
+ "eslint": ">=9.9.1",
52
+ "typescript": ">=5.5.4"
44
53
  },
45
- "packageManager": "pnpm@7.14.0",
46
- "volta": {
47
- "node": "16.18.0"
54
+ "engines": {
55
+ "node": ">=18.18.0"
48
56
  },
49
57
  "scripts": {
50
- "release": "changeset publish",
51
- "test": "eslint .",
52
- "changeset-version": "changeset version && prettier --write ."
58
+ "lint": "pnpm run '/^lint:.*/'",
59
+ "format": "pnpm run '/^format:.*/'",
60
+ "format:eslint": "eslint --fix .",
61
+ "format:prettier": "prettier --write .",
62
+ "lint:eslint": "eslint .",
63
+ "lint:tsc": "tsc --noEmit",
64
+ "build": "tsdown",
65
+ "lint:prettier": "prettier --check .",
66
+ "version": "changeset version && prettier --write .",
67
+ "release": "changeset publish"
53
68
  }
54
69
  }
package/.eslintrc.js DELETED
@@ -1,216 +0,0 @@
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;