@snowyyd/eslint-config 1.2.1 → 2.1.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/LICENSE +1 -1
- package/README.md +64 -54
- package/dist/airbnb-base.d.ts +3 -0
- package/dist/airbnb-base.js +34 -0
- package/dist/airbnb-ts.d.ts +3 -0
- package/dist/airbnb-ts.js +47 -0
- package/dist/esm.d.ts +3 -0
- package/dist/esm.js +27 -0
- package/dist/index.d.ts +19 -0
- package/dist/index.js +18 -0
- package/dist/personal.d.ts +3 -0
- package/dist/personal.js +74 -0
- package/dist/recommended.d.ts +3 -0
- package/dist/recommended.js +16 -0
- package/dist/rules/airbnb-base/best-practices.d.ts +175 -0
- package/dist/rules/airbnb-base/best-practices.js +164 -0
- package/dist/rules/airbnb-base/errors.d.ts +66 -0
- package/dist/rules/airbnb-base/errors.js +62 -0
- package/dist/rules/airbnb-base/es6.d.ts +145 -0
- package/dist/rules/airbnb-base/es6.js +85 -0
- package/dist/rules/airbnb-base/imports.d.ts +308 -0
- package/dist/rules/airbnb-base/imports.js +128 -0
- package/dist/rules/airbnb-base/node.d.ts +105 -0
- package/dist/rules/airbnb-base/node.js +26 -0
- package/dist/rules/airbnb-base/strict.d.ts +89 -0
- package/dist/rules/airbnb-base/strict.js +12 -0
- package/dist/rules/airbnb-base/style.d.ts +323 -0
- package/dist/rules/airbnb-base/style.js +272 -0
- package/dist/rules/airbnb-base/variables.d.ts +34 -0
- package/dist/rules/airbnb-base/variables.js +32 -0
- package/dist/rules/personal/shared.d.ts +13 -0
- package/dist/rules/personal/shared.js +18 -0
- package/dist/typescript.d.ts +3 -0
- package/dist/typescript.js +12 -0
- package/package.json +35 -44
- package/base.d.ts +0 -3
- package/base.js +0 -10
- package/esm.d.ts +0 -3
- package/esm.js +0 -11
- package/index.d.ts +0 -5
- package/index.js +0 -21
- package/lib/convert-configs.js +0 -47
- package/lib/esm.js +0 -23
- package/lib/personal.js +0 -83
- package/lib/shared.js +0 -219
- package/react-esm.d.ts +0 -3
- package/react-esm.js +0 -23
package/LICENSE
CHANGED
package/README.md
CHANGED
|
@@ -1,85 +1,95 @@
|
|
|
1
1
|
# eslint-config-x
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
3
|
+
|
|
4
|
+
**eslint-config-x** is a modern, modular ESLint configuration inspired by the widely-used [Airbnb style guide](https://github.com/airbnb/javascript/tree/master/packages/eslint-config-airbnb-base), rewritten entirely using [FlatConfig](https://eslint.org/docs/latest/use/configure/configuration-files) — the new configuration format introduced in ESLint v9.
|
|
5
|
+
This package offers optional TypeScript support, a handful of well curated extra configurations, as well as a personal config.
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
## ✨ Why use this?
|
|
9
|
+
- 📦 **FlatConfig ready** — designed for ESLint v9+
|
|
10
|
+
- 🧼 **Airbnb base rules** — familiar, community-tested style
|
|
11
|
+
- ✨ **Airbnb-style, modernized** — no more deprecated rules
|
|
12
|
+
- 🧠 **Optional TypeScript support** — no assumptions about your stack
|
|
13
|
+
- 🧩 **Use only what you need** — configurations are exported individually and can be composed freely
|
|
14
|
+
- 🚧 **Includes my very personal config** — for advanced tinkering (not for public use)
|
|
15
|
+
|
|
5
16
|
|
|
6
17
|
> [!IMPORTANT]
|
|
7
|
-
>
|
|
8
|
-
>
|
|
18
|
+
> #### Looking for a more faithful Airbnb FlatConfig conversion?
|
|
19
|
+
> If you landed here expecting a closer 1:1 conversion of the original `eslint-config-airbnb-base` (including legacy or deprecated rules), this config may not be what you're looking for — it makes modernizing decisions and drops outdated patterns.
|
|
9
20
|
>
|
|
10
|
-
>
|
|
11
|
-
>
|
|
12
|
-
>
|
|
13
|
-
|
|
14
|
-
|
|
21
|
+
> Instead, check out these alternatives:
|
|
22
|
+
>
|
|
23
|
+
> - https://github.com/claabs/eslint-config-airbnb-typescript-x
|
|
24
|
+
> - https://github.com/Kenneth-Sills/eslint-config-airbnb-typescript
|
|
25
|
+
> - The `v1` branch of this repository is based on the @claabs's implementation (this repository was a fork).
|
|
15
26
|
|
|
16
|
-
```shell
|
|
17
|
-
npm install --save-dev typescript-eslint
|
|
18
|
-
npm install --save-dev @snowyyd/eslint-config
|
|
19
|
-
```
|
|
20
27
|
|
|
21
|
-
##
|
|
28
|
+
## 🚀 Quick Start
|
|
22
29
|
|
|
23
30
|
> [!TIP]
|
|
24
|
-
>
|
|
31
|
+
> Please verify that your package manager correctly installs the “peerDependencies”.
|
|
25
32
|
|
|
26
|
-
|
|
27
|
-
```
|
|
28
|
-
|
|
33
|
+
1. First, install eslint if it's not yet installed (locally or globally).
|
|
34
|
+
```bash
|
|
35
|
+
npm install -save-dev eslint
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
2. Then, install the package as a development dependency.
|
|
39
|
+
```bash
|
|
40
|
+
npm install --save-dev @snowyyd/eslint-config
|
|
41
|
+
```
|
|
29
42
|
|
|
30
|
-
|
|
43
|
+
3. Create an ESLint config file `eslint.config.mjs` in the root folder of your project. You can use the following as an example:
|
|
44
|
+
```js
|
|
45
|
+
// @ts-check
|
|
46
|
+
|
|
47
|
+
/* eslint-disable import-x/no-extraneous-dependencies */
|
|
48
|
+
import { configs } from '@snowyyd/eslint-config';
|
|
31
49
|
import tseslint from 'typescript-eslint';
|
|
32
50
|
|
|
33
51
|
export default tseslint.config(
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
...tseslint.configs.stylisticTypeChecked,
|
|
52
|
+
configs.recommended,
|
|
53
|
+
configs.esm,
|
|
37
54
|
{
|
|
38
55
|
ignores: ['dist/**'],
|
|
39
56
|
languageOptions: {
|
|
40
57
|
parserOptions: {
|
|
41
|
-
projectService:
|
|
42
|
-
// add other config files below (e.g.: tsup.config.ts)
|
|
43
|
-
allowDefaultProject: ['eslint.config.mjs'],
|
|
44
|
-
},
|
|
58
|
+
projectService: true,
|
|
45
59
|
tsconfigRootDir: import.meta.dirname,
|
|
46
60
|
},
|
|
47
61
|
},
|
|
48
62
|
},
|
|
49
63
|
);
|
|
64
|
+
```
|
|
50
65
|
|
|
66
|
+
|
|
67
|
+
## 🍉 Exported presets
|
|
68
|
+
Each preset is conveniently exported in a “configs” object, as well as part of the default export.
|
|
69
|
+
```typescript
|
|
70
|
+
import { configs } from '@snowyyd/eslint-config';
|
|
71
|
+
import configX from '@snowyyd/eslint-config'; // access configs on configsX.configs
|
|
51
72
|
```
|
|
52
73
|
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
74
|
+
The list of presets includes:
|
|
75
|
+
- `recommended`: The main preset for this project. It includes all the Airbnb rules, as well as the recommended eslint, typescript-eslint, recommended typed linting and stylistic presets.
|
|
76
|
+
- `esm`: Extra rules for ESM projects.
|
|
77
|
+
- `airbnb`: Airbnb configuration exported for convenience, without any additions (only with updated rules).
|
|
78
|
+
- `airbnbTs`: The Airbnb configuration with fully TypeScript support.
|
|
79
|
+
- `personal`: My personal rules that I usually apply over the Airbnb ones.
|
|
80
|
+
- `typescript`: The recommended typescript-eslint rules (with typed linting and stylistic type linting).
|
|
56
81
|
|
|
57
|
-
|
|
58
|
-
|
|
82
|
+
The `recommended` preset extends the rules in the following order: `airbnbTs > eslint-recommended > typescript > personal`.
|
|
83
|
+
TypeScript rules are only used in compatible files, so this configuration is perfectly safe for JavaScript projects.
|
|
84
|
+
|
|
85
|
+
In the `recommended` preset my personal rules takes precedence over the recommended ones. Likewise, those rules take priority over the Airbnb ones. This means that Airbnb settings serve as a base, the recommended settings build on top of them, and finally my personal preferences are applied last.
|
|
86
|
+
|
|
87
|
+
> [!NOTE]
|
|
88
|
+
> Please note that some presets expect to be loaded after others.
|
|
89
|
+
> For example, `personal` expects that `airbnbTs` and `typescript` were loaded earlier.
|
|
90
|
+
>
|
|
91
|
+
> While the presets are independent, the rules themselves may not make sense separately.
|
|
59
92
|
|
|
60
|
-
export default tseslint.config(
|
|
61
|
-
...configX,
|
|
62
|
-
{
|
|
63
|
-
ignores: ['dist/**'],
|
|
64
|
-
languageOptions: {
|
|
65
|
-
parserOptions: {
|
|
66
|
-
projectService: {
|
|
67
|
-
// add other config files below (e.g.: tsup.config.ts)
|
|
68
|
-
allowDefaultProject: ['eslint.config.mjs'],
|
|
69
|
-
},
|
|
70
|
-
tsconfigRootDir: import.meta.dirname,
|
|
71
|
-
},
|
|
72
|
-
},
|
|
73
|
-
},
|
|
74
|
-
{
|
|
75
|
-
files: ['**/*.ts', '**/*.tsx', '**/*.mts', '**/*.cts'],
|
|
76
|
-
extends: [
|
|
77
|
-
...tseslint.configs.recommendedTypeChecked,
|
|
78
|
-
...tseslint.configs.stylisticTypeChecked,
|
|
79
|
-
],
|
|
80
|
-
},
|
|
81
|
-
);
|
|
82
|
-
```
|
|
83
93
|
|
|
84
94
|
## 📝 Changelog
|
|
85
95
|
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import stylistic from '@stylistic/eslint-plugin';
|
|
2
|
+
import importX from 'eslint-plugin-import-x';
|
|
3
|
+
import bestPractices from "./rules/airbnb-base/best-practices.js";
|
|
4
|
+
import errors from "./rules/airbnb-base/errors.js";
|
|
5
|
+
import es6 from "./rules/airbnb-base/es6.js";
|
|
6
|
+
import imports from "./rules/airbnb-base/imports.js";
|
|
7
|
+
import node from "./rules/airbnb-base/node.js";
|
|
8
|
+
import strict from "./rules/airbnb-base/strict.js";
|
|
9
|
+
import style from "./rules/airbnb-base/style.js";
|
|
10
|
+
import variables from "./rules/airbnb-base/variables.js";
|
|
11
|
+
// based on https://github.com/airbnb/javascript/commit/11f986fdc7d6b4c80e396437e9c45c939362bdee
|
|
12
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
13
|
+
export default (plugin, parser) => [
|
|
14
|
+
{
|
|
15
|
+
name: '@snowyyd/eslint-config-x/airbnb-base',
|
|
16
|
+
plugins: {
|
|
17
|
+
// '@typescript-eslint': plugin,
|
|
18
|
+
'@stylistic': stylistic,
|
|
19
|
+
'import-x': importX,
|
|
20
|
+
},
|
|
21
|
+
languageOptions: {
|
|
22
|
+
ecmaVersion: 2018,
|
|
23
|
+
sourceType: 'module',
|
|
24
|
+
},
|
|
25
|
+
},
|
|
26
|
+
bestPractices,
|
|
27
|
+
errors,
|
|
28
|
+
node,
|
|
29
|
+
style,
|
|
30
|
+
variables,
|
|
31
|
+
es6,
|
|
32
|
+
imports,
|
|
33
|
+
strict,
|
|
34
|
+
];
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import airbnbBase from "./airbnb-base.js";
|
|
2
|
+
import bestPractices from "./rules/airbnb-base/best-practices.js";
|
|
3
|
+
import es6 from "./rules/airbnb-base/es6.js";
|
|
4
|
+
import style from "./rules/airbnb-base/style.js";
|
|
5
|
+
import variables from "./rules/airbnb-base/variables.js";
|
|
6
|
+
function replaceRule(ruleName, baseConfig, newName) {
|
|
7
|
+
if (!baseConfig.rules || !(ruleName in (baseConfig.rules))) {
|
|
8
|
+
throw new Error('invalid rule data for ' + ruleName);
|
|
9
|
+
}
|
|
10
|
+
return {
|
|
11
|
+
[ruleName]: 'off',
|
|
12
|
+
[`@typescript-eslint/${newName ?? ruleName}`]: baseConfig.rules[ruleName],
|
|
13
|
+
};
|
|
14
|
+
}
|
|
15
|
+
export default (plugin, parser) => [
|
|
16
|
+
...airbnbBase(plugin, parser),
|
|
17
|
+
{
|
|
18
|
+
name: '@snowyyd/eslint-config-x/airbnb-ts',
|
|
19
|
+
files: ['**/*.ts', '**/*.tsx', '**/*.mts', '**/*.cts'],
|
|
20
|
+
rules: {
|
|
21
|
+
...replaceRule('class-methods-use-this', bestPractices),
|
|
22
|
+
...replaceRule('consistent-return', bestPractices),
|
|
23
|
+
...replaceRule('default-param-last', bestPractices),
|
|
24
|
+
...replaceRule('dot-notation', bestPractices),
|
|
25
|
+
...replaceRule('no-empty-function', bestPractices),
|
|
26
|
+
...replaceRule('no-implied-eval', bestPractices),
|
|
27
|
+
// ...replaceRule('no-invalid-this', bestPractices),
|
|
28
|
+
...replaceRule('no-loop-func', bestPractices),
|
|
29
|
+
// ...replaceRule('no-magic-numbers', bestPractices),
|
|
30
|
+
...replaceRule('no-redeclare', bestPractices),
|
|
31
|
+
...replaceRule('no-throw-literal', bestPractices, 'only-throw-error'),
|
|
32
|
+
...replaceRule('no-unused-expressions', bestPractices),
|
|
33
|
+
...replaceRule('prefer-promise-reject-errors', bestPractices),
|
|
34
|
+
// ...replaceRule('require-await', bestPractices),
|
|
35
|
+
// ...replaceRule('max-params', style),
|
|
36
|
+
...replaceRule('no-array-constructor', style),
|
|
37
|
+
...replaceRule('init-declarations', variables),
|
|
38
|
+
...replaceRule('no-shadow', variables),
|
|
39
|
+
...replaceRule('no-unused-vars', variables),
|
|
40
|
+
...replaceRule('no-use-before-define', variables),
|
|
41
|
+
...replaceRule('no-dupe-class-members', es6),
|
|
42
|
+
// ...replaceRule('no-restricted-imports', es6),
|
|
43
|
+
...replaceRule('no-useless-constructor', es6),
|
|
44
|
+
...replaceRule('prefer-destructuring', es6),
|
|
45
|
+
},
|
|
46
|
+
},
|
|
47
|
+
];
|
package/dist/esm.d.ts
ADDED
package/dist/esm.js
ADDED
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import importX from 'eslint-plugin-import-x';
|
|
2
|
+
import shared from "./rules/personal/shared.js";
|
|
3
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
4
|
+
export default (plugin, parser) => [
|
|
5
|
+
{
|
|
6
|
+
name: '@snowyyd/eslint-config-x/esm',
|
|
7
|
+
plugins: {
|
|
8
|
+
'import-x': importX,
|
|
9
|
+
},
|
|
10
|
+
rules: {
|
|
11
|
+
// extensions are mandatory in ESM
|
|
12
|
+
'import-x/extensions': ['error', 'ignorePackages'],
|
|
13
|
+
'no-restricted-globals': [
|
|
14
|
+
...shared.rules['no-restricted-globals'],
|
|
15
|
+
// __dirname & __filename cannot be used in ESM
|
|
16
|
+
{
|
|
17
|
+
name: '__dirname',
|
|
18
|
+
message: 'Not available in ES modules. Use `import.meta.dirname` instead. https://nodejs.org/api/esm.html#no-__filename-or-__dirname',
|
|
19
|
+
},
|
|
20
|
+
{
|
|
21
|
+
name: '__filename',
|
|
22
|
+
message: 'Not available in ES modules. Use `import.meta.filename` instead. https://nodejs.org/api/esm.html#no-__filename-or-__dirname',
|
|
23
|
+
},
|
|
24
|
+
],
|
|
25
|
+
},
|
|
26
|
+
},
|
|
27
|
+
];
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
export declare const configs: {
|
|
2
|
+
recommended: import("@typescript-eslint/utils/ts-eslint").FlatConfig.ConfigArray;
|
|
3
|
+
esm: import("@typescript-eslint/utils/ts-eslint").FlatConfig.ConfigArray;
|
|
4
|
+
airbnb: import("@typescript-eslint/utils/ts-eslint").FlatConfig.ConfigArray;
|
|
5
|
+
airbnbTs: import("@typescript-eslint/utils/ts-eslint").FlatConfig.ConfigArray;
|
|
6
|
+
personal: import("@typescript-eslint/utils/ts-eslint").FlatConfig.ConfigArray;
|
|
7
|
+
typescript: import("@typescript-eslint/utils/ts-eslint").FlatConfig.ConfigArray;
|
|
8
|
+
};
|
|
9
|
+
declare const _default: {
|
|
10
|
+
configs: {
|
|
11
|
+
recommended: import("@typescript-eslint/utils/ts-eslint").FlatConfig.ConfigArray;
|
|
12
|
+
esm: import("@typescript-eslint/utils/ts-eslint").FlatConfig.ConfigArray;
|
|
13
|
+
airbnb: import("@typescript-eslint/utils/ts-eslint").FlatConfig.ConfigArray;
|
|
14
|
+
airbnbTs: import("@typescript-eslint/utils/ts-eslint").FlatConfig.ConfigArray;
|
|
15
|
+
personal: import("@typescript-eslint/utils/ts-eslint").FlatConfig.ConfigArray;
|
|
16
|
+
typescript: import("@typescript-eslint/utils/ts-eslint").FlatConfig.ConfigArray;
|
|
17
|
+
};
|
|
18
|
+
};
|
|
19
|
+
export default _default;
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import tseslint from 'typescript-eslint';
|
|
2
|
+
import airbnbBase from "./airbnb-base.js";
|
|
3
|
+
import airbnbTs from "./airbnb-ts.js";
|
|
4
|
+
import esm from "./esm.js";
|
|
5
|
+
import personal from "./personal.js";
|
|
6
|
+
import recommended from "./recommended.js";
|
|
7
|
+
import typescript from "./typescript.js";
|
|
8
|
+
export const configs = {
|
|
9
|
+
recommended: recommended(tseslint.plugin, tseslint.parser),
|
|
10
|
+
esm: esm(tseslint.plugin, tseslint.parser),
|
|
11
|
+
airbnb: airbnbBase(tseslint.plugin, tseslint.parser),
|
|
12
|
+
airbnbTs: airbnbTs(tseslint.plugin, tseslint.parser),
|
|
13
|
+
personal: personal(tseslint.plugin, tseslint.parser),
|
|
14
|
+
typescript: typescript(tseslint.plugin, tseslint.parser),
|
|
15
|
+
};
|
|
16
|
+
export default {
|
|
17
|
+
configs,
|
|
18
|
+
};
|
package/dist/personal.js
ADDED
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
import stylistic from '@stylistic/eslint-plugin';
|
|
2
|
+
import importX from 'eslint-plugin-import-x';
|
|
3
|
+
import shared from "./rules/personal/shared.js";
|
|
4
|
+
export default (plugin, parser) => [
|
|
5
|
+
{
|
|
6
|
+
name: '@snowyyd/eslint-config-x/personal',
|
|
7
|
+
languageOptions: {
|
|
8
|
+
parser,
|
|
9
|
+
parserOptions: {
|
|
10
|
+
projectService: true,
|
|
11
|
+
// tsconfigRootDir: import.meta.dirname,
|
|
12
|
+
},
|
|
13
|
+
},
|
|
14
|
+
plugins: {
|
|
15
|
+
'@typescript-eslint': plugin,
|
|
16
|
+
'@stylistic': stylistic,
|
|
17
|
+
'import-x': importX,
|
|
18
|
+
},
|
|
19
|
+
rules: {
|
|
20
|
+
/**
|
|
21
|
+
* imports
|
|
22
|
+
*/
|
|
23
|
+
'import-x/no-dynamic-require': 'off',
|
|
24
|
+
'import-x/prefer-default-export': 'off',
|
|
25
|
+
/**
|
|
26
|
+
* best practices
|
|
27
|
+
*/
|
|
28
|
+
// no longer needed: https://eslint.org/docs/latest/rules/no-return-await
|
|
29
|
+
// TODO: check https://typescript-eslint.io/rules/return-await/
|
|
30
|
+
'no-return-await': 'off',
|
|
31
|
+
'prefer-template': 'off',
|
|
32
|
+
'prefer-destructuring': 'off',
|
|
33
|
+
'prefer-arrow-callback': 'off',
|
|
34
|
+
'prefer-const': ['error', {
|
|
35
|
+
destructuring: 'any',
|
|
36
|
+
// this is needed as `no-use-before-define` is used in airbnb/variables and is overwritten in tseslint
|
|
37
|
+
// https://github.com/typescript-eslint/typescript-eslint/blob/af94f163a1d6447a84c5571fff5e38e4c700edb9/packages/eslint-plugin/src/configs/eslint-recommended-raw.ts#L42
|
|
38
|
+
ignoreReadBeforeAssign: true, // this is needed
|
|
39
|
+
}],
|
|
40
|
+
'no-console': 'off',
|
|
41
|
+
'no-param-reassign': 'off',
|
|
42
|
+
'no-plusplus': 'off',
|
|
43
|
+
'no-continue': 'off',
|
|
44
|
+
'no-restricted-globals': shared.rules['no-restricted-globals'],
|
|
45
|
+
'no-restricted-properties': 'off',
|
|
46
|
+
'no-restricted-syntax': [
|
|
47
|
+
'error',
|
|
48
|
+
{
|
|
49
|
+
selector: 'ForInStatement',
|
|
50
|
+
message: 'for..in loops iterate over the entire prototype chain, which is virtually never what you want. Use Object.{keys,values,entries}, and iterate over the resulting array.',
|
|
51
|
+
},
|
|
52
|
+
],
|
|
53
|
+
/**
|
|
54
|
+
* styling & formatting
|
|
55
|
+
*/
|
|
56
|
+
'@stylistic/object-curly-newline': ['error', {
|
|
57
|
+
ObjectExpression: { minProperties: 4, multiline: true, consistent: true },
|
|
58
|
+
ObjectPattern: { minProperties: 4, multiline: true, consistent: true },
|
|
59
|
+
ImportDeclaration: 'never',
|
|
60
|
+
ExportDeclaration: 'never',
|
|
61
|
+
}],
|
|
62
|
+
'@stylistic/brace-style': ['error', 'allman', { allowSingleLine: true }],
|
|
63
|
+
'@stylistic/indent': ['error', 'tab', { SwitchCase: 1 }],
|
|
64
|
+
'@stylistic/no-tabs': ['error', { allowIndentationTabs: true }],
|
|
65
|
+
'@stylistic/max-len': 'off',
|
|
66
|
+
'@stylistic/quotes': ['error', 'single', { avoidEscape: true }],
|
|
67
|
+
'@stylistic/comma-dangle': ['error', 'always-multiline'],
|
|
68
|
+
// TypeScript
|
|
69
|
+
'@stylistic/type-annotation-spacing': 'error',
|
|
70
|
+
'@stylistic/type-generic-spacing': 'error',
|
|
71
|
+
'@stylistic/member-delimiter-style': 'error',
|
|
72
|
+
},
|
|
73
|
+
},
|
|
74
|
+
];
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import eslint from '@eslint/js';
|
|
2
|
+
import airbnbTs from "./airbnb-ts.js";
|
|
3
|
+
import personal from "./personal.js";
|
|
4
|
+
import typescript from "./typescript.js";
|
|
5
|
+
export default (plugin, parser) => [
|
|
6
|
+
...airbnbTs(plugin, parser),
|
|
7
|
+
// recommended JavaScript
|
|
8
|
+
{
|
|
9
|
+
name: 'eslint/eslint-recommended',
|
|
10
|
+
...eslint.configs.recommended,
|
|
11
|
+
},
|
|
12
|
+
// recommended TypeScript (might depend on eslint-recommended)
|
|
13
|
+
...typescript(plugin, parser),
|
|
14
|
+
// personal configs
|
|
15
|
+
...personal(plugin, parser),
|
|
16
|
+
];
|
|
@@ -0,0 +1,175 @@
|
|
|
1
|
+
declare const _default: {
|
|
2
|
+
name: string;
|
|
3
|
+
rules: {
|
|
4
|
+
'accessor-pairs': "off";
|
|
5
|
+
'array-callback-return': ["error", {
|
|
6
|
+
allowImplicit: boolean;
|
|
7
|
+
}];
|
|
8
|
+
'block-scoped-var': "error";
|
|
9
|
+
complexity: ["off", number];
|
|
10
|
+
'class-methods-use-this': ["error", {
|
|
11
|
+
exceptMethods: never[];
|
|
12
|
+
}];
|
|
13
|
+
'consistent-return': "error";
|
|
14
|
+
curly: ["error", string];
|
|
15
|
+
'default-case': ["error", {
|
|
16
|
+
commentPattern: string;
|
|
17
|
+
}];
|
|
18
|
+
'default-case-last': "error";
|
|
19
|
+
'default-param-last': "error";
|
|
20
|
+
'dot-notation': ["error", {
|
|
21
|
+
allowKeywords: boolean;
|
|
22
|
+
}];
|
|
23
|
+
'@stylistic/dot-location': ["error", string];
|
|
24
|
+
eqeqeq: ["error", string, {
|
|
25
|
+
null: string;
|
|
26
|
+
}];
|
|
27
|
+
'grouped-accessor-pairs': "error";
|
|
28
|
+
'guard-for-in': "error";
|
|
29
|
+
'max-classes-per-file': ["error", number];
|
|
30
|
+
'no-alert': "warn";
|
|
31
|
+
'no-caller': "error";
|
|
32
|
+
'no-case-declarations': "error";
|
|
33
|
+
'no-constructor-return': "error";
|
|
34
|
+
'no-div-regex': "off";
|
|
35
|
+
'no-else-return': ["error", {
|
|
36
|
+
allowElseIf: boolean;
|
|
37
|
+
}];
|
|
38
|
+
'no-empty-function': ["error", {
|
|
39
|
+
allow: string[];
|
|
40
|
+
}];
|
|
41
|
+
'no-empty-pattern': "error";
|
|
42
|
+
'no-empty-static-block': "off";
|
|
43
|
+
'no-eq-null': "off";
|
|
44
|
+
'no-eval': "error";
|
|
45
|
+
'no-extend-native': "error";
|
|
46
|
+
'no-extra-bind': "error";
|
|
47
|
+
'no-extra-label': "error";
|
|
48
|
+
'no-fallthrough': "error";
|
|
49
|
+
'@stylistic/no-floating-decimal': "error";
|
|
50
|
+
'no-global-assign': ["error", {
|
|
51
|
+
exceptions: never[];
|
|
52
|
+
}];
|
|
53
|
+
'no-implicit-coercion': ["off", {
|
|
54
|
+
boolean: boolean;
|
|
55
|
+
number: boolean;
|
|
56
|
+
string: boolean;
|
|
57
|
+
allow: never[];
|
|
58
|
+
}];
|
|
59
|
+
'no-implicit-globals': "off";
|
|
60
|
+
'no-implied-eval': "error";
|
|
61
|
+
'no-invalid-this': "off";
|
|
62
|
+
'no-iterator': "error";
|
|
63
|
+
'no-labels': ["error", {
|
|
64
|
+
allowLoop: boolean;
|
|
65
|
+
allowSwitch: boolean;
|
|
66
|
+
}];
|
|
67
|
+
'no-lone-blocks': "error";
|
|
68
|
+
'no-loop-func': "error";
|
|
69
|
+
'no-magic-numbers': ["off", {
|
|
70
|
+
ignore: never[];
|
|
71
|
+
ignoreArrayIndexes: boolean;
|
|
72
|
+
enforceConst: boolean;
|
|
73
|
+
detectObjects: boolean;
|
|
74
|
+
}];
|
|
75
|
+
'@stylistic/no-multi-spaces': ["error", {
|
|
76
|
+
ignoreEOLComments: boolean;
|
|
77
|
+
}];
|
|
78
|
+
'no-multi-str': "error";
|
|
79
|
+
'no-new': "error";
|
|
80
|
+
'no-new-func': "error";
|
|
81
|
+
'no-new-wrappers': "error";
|
|
82
|
+
'no-nonoctal-decimal-escape': "error";
|
|
83
|
+
'no-object-constructor': "error";
|
|
84
|
+
'no-octal': "error";
|
|
85
|
+
'no-octal-escape': "error";
|
|
86
|
+
'no-param-reassign': ["error", {
|
|
87
|
+
props: boolean;
|
|
88
|
+
ignorePropertyModificationsFor: string[];
|
|
89
|
+
}];
|
|
90
|
+
'no-proto': "error";
|
|
91
|
+
'no-redeclare': "error";
|
|
92
|
+
'no-restricted-properties': ["error", {
|
|
93
|
+
object: string;
|
|
94
|
+
property: string;
|
|
95
|
+
message: string;
|
|
96
|
+
}, {
|
|
97
|
+
object: string;
|
|
98
|
+
property: string;
|
|
99
|
+
message: string;
|
|
100
|
+
}, {
|
|
101
|
+
object: string;
|
|
102
|
+
property: string;
|
|
103
|
+
message: string;
|
|
104
|
+
}, {
|
|
105
|
+
object: string;
|
|
106
|
+
property: string;
|
|
107
|
+
message: string;
|
|
108
|
+
}, {
|
|
109
|
+
object: string;
|
|
110
|
+
property: string;
|
|
111
|
+
message: string;
|
|
112
|
+
}, {
|
|
113
|
+
object: string;
|
|
114
|
+
property: string;
|
|
115
|
+
message: string;
|
|
116
|
+
}, {
|
|
117
|
+
object: string;
|
|
118
|
+
property: string;
|
|
119
|
+
message: string;
|
|
120
|
+
}, {
|
|
121
|
+
property: string;
|
|
122
|
+
message: string;
|
|
123
|
+
}, {
|
|
124
|
+
property: string;
|
|
125
|
+
message: string;
|
|
126
|
+
}, {
|
|
127
|
+
object: string;
|
|
128
|
+
property: string;
|
|
129
|
+
message: string;
|
|
130
|
+
}];
|
|
131
|
+
'no-return-assign': ["error", string];
|
|
132
|
+
'no-script-url': "error";
|
|
133
|
+
'no-self-assign': ["error", {
|
|
134
|
+
props: boolean;
|
|
135
|
+
}];
|
|
136
|
+
'no-self-compare': "error";
|
|
137
|
+
'no-sequences': "error";
|
|
138
|
+
'no-throw-literal': "error";
|
|
139
|
+
'no-unmodified-loop-condition': "off";
|
|
140
|
+
'no-unused-expressions': ["error", {
|
|
141
|
+
allowShortCircuit: boolean;
|
|
142
|
+
allowTernary: boolean;
|
|
143
|
+
allowTaggedTemplates: boolean;
|
|
144
|
+
}];
|
|
145
|
+
'no-unused-labels': "error";
|
|
146
|
+
'no-useless-call': "off";
|
|
147
|
+
'no-useless-catch': "error";
|
|
148
|
+
'no-useless-concat': "error";
|
|
149
|
+
'no-useless-escape': "error";
|
|
150
|
+
'no-useless-return': "error";
|
|
151
|
+
'no-void': "error";
|
|
152
|
+
'no-warning-comments': ["off", {
|
|
153
|
+
terms: string[];
|
|
154
|
+
location: string;
|
|
155
|
+
}];
|
|
156
|
+
'no-with': "error";
|
|
157
|
+
'prefer-promise-reject-errors': ["error", {
|
|
158
|
+
allowEmptyReject: boolean;
|
|
159
|
+
}];
|
|
160
|
+
'prefer-named-capture-group': "off";
|
|
161
|
+
'prefer-object-has-own': "off";
|
|
162
|
+
'prefer-regex-literals': ["error", {
|
|
163
|
+
disallowRedundantWrapping: boolean;
|
|
164
|
+
}];
|
|
165
|
+
radix: "error";
|
|
166
|
+
'require-await': "off";
|
|
167
|
+
'require-unicode-regexp': "off";
|
|
168
|
+
'vars-on-top': "error";
|
|
169
|
+
'@stylistic/wrap-iife': ["error", string, {
|
|
170
|
+
functionPrototypeMethods: boolean;
|
|
171
|
+
}];
|
|
172
|
+
yoda: "error";
|
|
173
|
+
};
|
|
174
|
+
};
|
|
175
|
+
export default _default;
|