@averay/codeformat 0.1.13 → 0.2.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/.editorconfig +1 -0
- package/.stylelintignore +1 -0
- package/CODE_OF_CONDUCT.md +83 -0
- package/README.md +2 -2
- package/bin-codeformat.sh +11 -7
- package/eslint.config.js +2 -2
- package/lib/convertWarnsToErrors.ts +43 -0
- package/package.json +36 -45
- package/rulesets/eslint/ruleset-shared.ts +346 -0
- package/rulesets/eslint/ruleset-typescript.ts +226 -0
- package/rulesets/stylelint/ruleset-css.ts +22 -0
- package/rulesets/stylelint/ruleset-scss.ts +33 -0
- package/src/extensions.ts +7 -0
- package/src/index.ts +4 -0
- package/src/makeEslintConfig.ts +98 -0
- package/src/makeStylelintConfig.ts +37 -0
- package/stylelint.config.cjs +1 -1
- package/tsconfig.base.json +28 -0
- package/tsconfig.json +10 -0
- package/types.d.ts +97 -0
- package/dist/codeformat.cjs +0 -791
- package/dist/codeformat.cjs.map +0 -1
- package/dist/codeformat.mjs +0 -750
- package/dist/codeformat.mjs.map +0 -1
package/.editorconfig
CHANGED
package/.stylelintignore
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
/node_modules
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
# Contributor Covenant Code of Conduct
|
|
2
|
+
|
|
3
|
+
## Our Pledge
|
|
4
|
+
|
|
5
|
+
We as members, contributors, and leaders pledge to make participation in our community a harassment-free experience for everyone, regardless of age, body size, visible or invisible disability, ethnicity, sex characteristics, gender identity and expression, level of experience, education, socio-economic status, nationality, personal appearance, race, caste, color, religion, or sexual identity and orientation.
|
|
6
|
+
|
|
7
|
+
We pledge to act and interact in ways that contribute to an open, welcoming, diverse, inclusive, and healthy community.
|
|
8
|
+
|
|
9
|
+
## Our Standards
|
|
10
|
+
|
|
11
|
+
Examples of behavior that contributes to a positive environment for our community include:
|
|
12
|
+
|
|
13
|
+
- Demonstrating empathy and kindness toward other people
|
|
14
|
+
- Being respectful of differing opinions, viewpoints, and experiences
|
|
15
|
+
- Giving and gracefully accepting constructive feedback
|
|
16
|
+
- Accepting responsibility and apologizing to those affected by our mistakes, and learning from the experience
|
|
17
|
+
- Focusing on what is best not just for us as individuals, but for the overall community
|
|
18
|
+
|
|
19
|
+
Examples of unacceptable behavior include:
|
|
20
|
+
|
|
21
|
+
- The use of sexualized language or imagery, and sexual attention or advances of any kind
|
|
22
|
+
- Trolling, insulting or derogatory comments, and personal or political attacks
|
|
23
|
+
- Public or private harassment
|
|
24
|
+
- Publishing others' private information, such as a physical or email address, without their explicit permission
|
|
25
|
+
- Other conduct which could reasonably be considered inappropriate in a professional setting
|
|
26
|
+
|
|
27
|
+
## Enforcement Responsibilities
|
|
28
|
+
|
|
29
|
+
Community leaders are responsible for clarifying and enforcing our standards of acceptable behavior and will take appropriate and fair corrective action in response to any behavior that they deem inappropriate, threatening, offensive, or harmful.
|
|
30
|
+
|
|
31
|
+
Community leaders have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct, and will communicate reasons for moderation decisions when appropriate.
|
|
32
|
+
|
|
33
|
+
## Scope
|
|
34
|
+
|
|
35
|
+
This Code of Conduct applies within all community spaces, and also applies when an individual is officially representing the community in public spaces. Examples of representing our community include using an official e-mail address, posting via an official social media account, or acting as an appointed representative at an online or offline event.
|
|
36
|
+
|
|
37
|
+
## Enforcement
|
|
38
|
+
|
|
39
|
+
Instances of abusive, harassing, or otherwise unacceptable behavior may be reported to the community leaders responsible for enforcement at [INSERT CONTACT METHOD]. All complaints will be reviewed and investigated promptly and fairly.
|
|
40
|
+
|
|
41
|
+
All community leaders are obligated to respect the privacy and security of the reporter of any incident.
|
|
42
|
+
|
|
43
|
+
## Enforcement Guidelines
|
|
44
|
+
|
|
45
|
+
Community leaders will follow these Community Impact Guidelines in determining the consequences for any action they deem in violation of this Code of Conduct:
|
|
46
|
+
|
|
47
|
+
### 1. Correction
|
|
48
|
+
|
|
49
|
+
**Community Impact**: Use of inappropriate language or other behavior deemed unprofessional or unwelcome in the community.
|
|
50
|
+
|
|
51
|
+
**Consequence**: A private, written warning from community leaders, providing clarity around the nature of the violation and an explanation of why the behavior was inappropriate. A public apology may be requested.
|
|
52
|
+
|
|
53
|
+
### 2. Warning
|
|
54
|
+
|
|
55
|
+
**Community Impact**: A violation through a single incident or series of actions.
|
|
56
|
+
|
|
57
|
+
**Consequence**: A warning with consequences for continued behavior. No interaction with the people involved, including unsolicited interaction with those enforcing the Code of Conduct, for a specified period of time. This includes avoiding interactions in community spaces as well as external channels like social media. Violating these terms may lead to a temporary or permanent ban.
|
|
58
|
+
|
|
59
|
+
### 3. Temporary Ban
|
|
60
|
+
|
|
61
|
+
**Community Impact**: A serious violation of community standards, including sustained inappropriate behavior.
|
|
62
|
+
|
|
63
|
+
**Consequence**: A temporary ban from any sort of interaction or public communication with the community for a specified period of time. No public or private interaction with the people involved, including unsolicited interaction with those enforcing the Code of Conduct, is allowed during this period. Violating these terms may lead to a permanent ban.
|
|
64
|
+
|
|
65
|
+
### 4. Permanent Ban
|
|
66
|
+
|
|
67
|
+
**Community Impact**: Demonstrating a pattern of violation of community standards, including sustained inappropriate behavior, harassment of an individual, or aggression toward or disparagement of classes of individuals.
|
|
68
|
+
|
|
69
|
+
**Consequence**: A permanent ban from any sort of public interaction within the community.
|
|
70
|
+
|
|
71
|
+
## Attribution
|
|
72
|
+
|
|
73
|
+
This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 2.1, available at [https://www.contributor-covenant.org/version/2/1/code_of_conduct.html][v2.1].
|
|
74
|
+
|
|
75
|
+
Community Impact Guidelines were inspired by [Mozilla's code of conduct enforcement ladder][mozilla coc].
|
|
76
|
+
|
|
77
|
+
For answers to common questions about this code of conduct, see the FAQ at [https://www.contributor-covenant.org/faq][faq]. Translations are available at [https://www.contributor-covenant.org/translations][translations].
|
|
78
|
+
|
|
79
|
+
[homepage]: https://www.contributor-covenant.org
|
|
80
|
+
[v2.1]: https://www.contributor-covenant.org/version/2/1/code_of_conduct.html
|
|
81
|
+
[mozilla coc]: https://github.com/mozilla/diversity
|
|
82
|
+
[faq]: https://www.contributor-covenant.org/faq
|
|
83
|
+
[translations]: https://www.contributor-covenant.org/translations
|
package/README.md
CHANGED
|
@@ -4,7 +4,7 @@ A very opinionated collection of configurations for a number of code formatting
|
|
|
4
4
|
|
|
5
5
|
## Default Usage
|
|
6
6
|
|
|
7
|
-
1. Install the package with `
|
|
7
|
+
1. Install the package with `bun i -D @averay/codeformat`
|
|
8
8
|
|
|
9
9
|
2. Symlink the static configuration files to the project root:
|
|
10
10
|
|
|
@@ -14,7 +14,7 @@ A very opinionated collection of configurations for a number of code formatting
|
|
|
14
14
|
|
|
15
15
|
3. Import and call the relevant configuration builders for specific tools
|
|
16
16
|
|
|
17
|
-
4. Lint the codebase with `
|
|
17
|
+
4. Lint the codebase with `bun x codeformat check`, or apply automatic fixes with `bun x codeformat fix`
|
|
18
18
|
|
|
19
19
|
### ESLint
|
|
20
20
|
|
package/bin-codeformat.sh
CHANGED
|
@@ -2,6 +2,10 @@
|
|
|
2
2
|
|
|
3
3
|
set -e
|
|
4
4
|
|
|
5
|
+
bunx() {
|
|
6
|
+
bun --bun x "$@"
|
|
7
|
+
}
|
|
8
|
+
|
|
5
9
|
# Parse arguments
|
|
6
10
|
ACTION="$1"
|
|
7
11
|
DIR="$2"
|
|
@@ -12,16 +16,16 @@ fi
|
|
|
12
16
|
CONFIG_PATH_TYPESCRIPT="$DIR/tsconfig.json"
|
|
13
17
|
|
|
14
18
|
if [ "$ACTION" = 'check' ]; then
|
|
15
|
-
|
|
16
|
-
|
|
19
|
+
bunx prettier --check "$DIR"
|
|
20
|
+
bunx eslint "$DIR"
|
|
17
21
|
if [ -f "$CONFIG_PATH_TYPESCRIPT" ]; then
|
|
18
|
-
|
|
22
|
+
bunx tsc --noEmit --project "$DIR/tsconfig.json"
|
|
19
23
|
fi
|
|
20
|
-
|
|
24
|
+
bunx stylelint --allow-empty-input "$DIR/**/*.{css,sass,scss}"
|
|
21
25
|
elif [ "$ACTION" = 'fix' ]; then
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
26
|
+
bunx prettier --write "$DIR"
|
|
27
|
+
bunx eslint --fix "$DIR"
|
|
28
|
+
bunx stylelint --fix --allow-empty-input "$DIR/**/*.{css,sass,scss}"
|
|
25
29
|
else
|
|
26
30
|
# Invalid/unset arguments
|
|
27
31
|
echo "Usage:
|
package/eslint.config.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import
|
|
1
|
+
import makeEslintConfig from './src/makeEslintConfig.ts';
|
|
2
2
|
|
|
3
3
|
export default [
|
|
4
4
|
{
|
|
5
5
|
ignores: ['dist/**/*.*'],
|
|
6
6
|
},
|
|
7
|
-
...makeEslintConfig(),
|
|
7
|
+
...makeEslintConfig({ tsconfigPath: './tsconfig.json' }),
|
|
8
8
|
];
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
type Converted<T> = {
|
|
2
|
+
[key in keyof T]: T[key] extends 'warn' | 1
|
|
3
|
+
? 'error'
|
|
4
|
+
: T[key] extends ['warn' | 1, ...infer Rest]
|
|
5
|
+
? ['error', ...Rest]
|
|
6
|
+
: T[key];
|
|
7
|
+
};
|
|
8
|
+
|
|
9
|
+
type Iterated<T extends Record<any, any>> = Iterable<[keyof T, T[keyof T]], unknown, unknown>;
|
|
10
|
+
|
|
11
|
+
const isWarning = (value: unknown): value is 'warn' | 1 => value === 'warn' || value === 1;
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* Replaces any `warn` values in the provided object with `error` (including those within arrays with configs), preserving all other values.
|
|
15
|
+
*
|
|
16
|
+
* @param ruleset The original ruleset to process.
|
|
17
|
+
* @returns The processed ruleset with warnings replaced with errors.
|
|
18
|
+
* @example
|
|
19
|
+
* convertWarnsToErrors({
|
|
20
|
+
* rule1: 'warn',
|
|
21
|
+
* rule2: ['warn', { foo: 'bar' }],
|
|
22
|
+
* rule3: 'off',
|
|
23
|
+
* })
|
|
24
|
+
* // {
|
|
25
|
+
* // rule1: 'error',
|
|
26
|
+
* // rule2: ['error', { foo: 'bar' }],
|
|
27
|
+
* // rule3: 'off',
|
|
28
|
+
* // }
|
|
29
|
+
*/
|
|
30
|
+
export default function convertWarnsToErrors<T extends Record<string, unknown>>(ruleset: T): Converted<T> {
|
|
31
|
+
const rulesetProcessed = {} as Converted<T>;
|
|
32
|
+
for (const [key, value] of Object.entries(ruleset) as Iterated<T>) {
|
|
33
|
+
let processedValue;
|
|
34
|
+
if (Array.isArray(value)) {
|
|
35
|
+
processedValue = [...value];
|
|
36
|
+
processedValue[0] = isWarning(processedValue[0]) ? 'error' : processedValue[0];
|
|
37
|
+
} else {
|
|
38
|
+
processedValue = isWarning(value) ? 'error' : value;
|
|
39
|
+
}
|
|
40
|
+
rulesetProcessed[key] = processedValue as Converted<T>[typeof key];
|
|
41
|
+
}
|
|
42
|
+
return rulesetProcessed;
|
|
43
|
+
}
|
package/package.json
CHANGED
|
@@ -1,69 +1,60 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@averay/codeformat",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.2.0",
|
|
4
4
|
"author": "Adam Averay (https://adamaveray.com.au/)",
|
|
5
5
|
"homepage": "https://github.com/adamaveray/codeformat",
|
|
6
6
|
"repository": {
|
|
7
7
|
"type": "git",
|
|
8
|
-
"url": "https://github.com/adamaveray/codeformat.git"
|
|
8
|
+
"url": "git+https://github.com/adamaveray/codeformat.git"
|
|
9
9
|
},
|
|
10
10
|
"licence": "MIT",
|
|
11
11
|
"description": "A very opinionated collection of configurations for a number of code formatting tools.",
|
|
12
12
|
"type": "module",
|
|
13
13
|
"engines": {
|
|
14
|
-
"
|
|
14
|
+
"bun": ">=1.2"
|
|
15
15
|
},
|
|
16
|
-
"source": "./src/index.
|
|
16
|
+
"source": "./src/index.ts",
|
|
17
17
|
"bin": {
|
|
18
|
-
"codeformat": "
|
|
18
|
+
"codeformat": "bin-codeformat.sh"
|
|
19
19
|
},
|
|
20
|
-
"main": "./
|
|
21
|
-
"exports": {
|
|
22
|
-
"require": "./dist/codeformat.cjs",
|
|
23
|
-
"default": "./dist/codeformat.mjs"
|
|
24
|
-
},
|
|
25
|
-
"files": [
|
|
26
|
-
".editorconfig",
|
|
27
|
-
".prettierrc.json",
|
|
28
|
-
"bin-codeformat.sh",
|
|
29
|
-
"dist",
|
|
30
|
-
"eslint.config.js",
|
|
31
|
-
"stylelint.config.cjs"
|
|
32
|
-
],
|
|
20
|
+
"main": "./src/index.ts",
|
|
33
21
|
"scripts": {
|
|
34
|
-
"
|
|
35
|
-
"dev": "microbundle watch --target=node --format=modern,cjs",
|
|
22
|
+
"test": "bun test",
|
|
36
23
|
"format": "./bin-codeformat.sh fix",
|
|
37
24
|
"lint": "./bin-codeformat.sh check",
|
|
38
|
-
"prepare": "husky
|
|
39
|
-
"prepack": "npm run build"
|
|
25
|
+
"prepare": "bun --bun x husky"
|
|
40
26
|
},
|
|
41
27
|
"dependencies": {
|
|
42
|
-
"@
|
|
43
|
-
"@eslint/
|
|
44
|
-
"@
|
|
45
|
-
"@
|
|
46
|
-
"eslint-
|
|
28
|
+
"@averay/css-properties-sort-order": "^1.0.1",
|
|
29
|
+
"@eslint/eslintrc": "3.2.0",
|
|
30
|
+
"@eslint/js": "9.20.0",
|
|
31
|
+
"@stylistic/eslint-plugin": "^3.1.0",
|
|
32
|
+
"@typescript-eslint/eslint-plugin": "8.24.0",
|
|
33
|
+
"@typescript-eslint/parser": "8.24.0",
|
|
34
|
+
"eslint-config-prettier": "10.0.1",
|
|
35
|
+
"eslint-import-resolver-typescript": "^3.8.3",
|
|
47
36
|
"eslint-plugin-eslint-comments": "^3.2.0",
|
|
48
|
-
"eslint-plugin-import": "^2.
|
|
49
|
-
"eslint-plugin-jsdoc": "
|
|
50
|
-
"eslint-plugin-promise": "
|
|
51
|
-
"eslint-plugin-regexp": "
|
|
52
|
-
"eslint-plugin-sonarjs": "
|
|
53
|
-
"eslint-plugin-unicorn": "
|
|
54
|
-
"globals": "
|
|
55
|
-
"postcss-scss": "^4.0.
|
|
56
|
-
"prettier": "
|
|
57
|
-
"stylelint": "
|
|
58
|
-
"stylelint-config-recommended": "
|
|
59
|
-
"stylelint-config-recommended-scss": "
|
|
60
|
-
"stylelint-config-standard": "
|
|
61
|
-
"stylelint-config-standard-scss": "
|
|
62
|
-
"stylelint-order": "^6.0.
|
|
63
|
-
"stylelint-scss": "
|
|
37
|
+
"eslint-plugin-import": "^2.31.0",
|
|
38
|
+
"eslint-plugin-jsdoc": "50.6.3",
|
|
39
|
+
"eslint-plugin-promise": "7.2.1",
|
|
40
|
+
"eslint-plugin-regexp": "2.7.0",
|
|
41
|
+
"eslint-plugin-sonarjs": "3.0.2",
|
|
42
|
+
"eslint-plugin-unicorn": "56.0.1",
|
|
43
|
+
"globals": "15.15.0",
|
|
44
|
+
"postcss-scss": "^4.0.9",
|
|
45
|
+
"prettier": "3.5.1",
|
|
46
|
+
"stylelint": "16.14.1",
|
|
47
|
+
"stylelint-config-recommended": "15.0.0",
|
|
48
|
+
"stylelint-config-recommended-scss": "14.1.0",
|
|
49
|
+
"stylelint-config-standard": "37.0.0",
|
|
50
|
+
"stylelint-config-standard-scss": "14.0.0",
|
|
51
|
+
"stylelint-order": "^6.0.4",
|
|
52
|
+
"stylelint-scss": "6.11.0",
|
|
53
|
+
"typescript-eslint": "^8.25.0"
|
|
64
54
|
},
|
|
65
55
|
"devDependencies": {
|
|
66
|
-
"
|
|
67
|
-
"
|
|
56
|
+
"@types/bun": "latest",
|
|
57
|
+
"husky": "9.1.7",
|
|
58
|
+
"typescript": "^5.8.2"
|
|
68
59
|
}
|
|
69
60
|
}
|
|
@@ -0,0 +1,346 @@
|
|
|
1
|
+
/* eslint sort-keys: 'error' -- Organise rules. */
|
|
2
|
+
/* eslint unicorn/no-useless-spread: "off" -- Keep the unprefixed core rules together. */
|
|
3
|
+
/* eslint import/no-named-as-default-member: "off" -- All plugins follow the same naming conventions. */
|
|
4
|
+
|
|
5
|
+
import stylisticPlugin from '@stylistic/eslint-plugin';
|
|
6
|
+
import { type TSESLint } from '@typescript-eslint/utils';
|
|
7
|
+
import eslintCommentsPlugin from 'eslint-plugin-eslint-comments';
|
|
8
|
+
import importPlugin from 'eslint-plugin-import';
|
|
9
|
+
import jsdocPlugin from 'eslint-plugin-jsdoc';
|
|
10
|
+
import promisePlugin from 'eslint-plugin-promise';
|
|
11
|
+
import regexpPlugin from 'eslint-plugin-regexp';
|
|
12
|
+
import sonarjsPlugin from 'eslint-plugin-sonarjs';
|
|
13
|
+
import unicornPlugin from 'eslint-plugin-unicorn';
|
|
14
|
+
|
|
15
|
+
export default {
|
|
16
|
+
...{
|
|
17
|
+
'accessor-pairs': ['error', { setWithoutGet: true }],
|
|
18
|
+
'array-callback-return': 'error',
|
|
19
|
+
'block-scoped-var': 'error',
|
|
20
|
+
'capitalized-comments': ['error', 'always', { ignoreConsecutiveComments: true }],
|
|
21
|
+
'consistent-return': 'error',
|
|
22
|
+
'consistent-this': ['error', '_this'],
|
|
23
|
+
'constructor-super': 'error',
|
|
24
|
+
'default-case': 'error',
|
|
25
|
+
'default-case-last': 'error',
|
|
26
|
+
'default-param-last': 'error',
|
|
27
|
+
'dot-notation': 'error',
|
|
28
|
+
eqeqeq: ['error', 'always', { null: 'ignore' }],
|
|
29
|
+
'for-direction': 'error',
|
|
30
|
+
'func-names': ['error', 'as-needed'],
|
|
31
|
+
'func-style': ['error', 'declaration', { allowArrowFunctions: true }],
|
|
32
|
+
'getter-return': 'error',
|
|
33
|
+
'global-require': 'error',
|
|
34
|
+
'grouped-accessor-pairs': ['error', 'getBeforeSet'],
|
|
35
|
+
'guard-for-in': 'error',
|
|
36
|
+
'id-denylist': ['error', 'cb', 'e', 'enc', 'err', 'evt'],
|
|
37
|
+
'lines-between-class-members': 'error',
|
|
38
|
+
'logical-assignment-operators': ['error', 'always'],
|
|
39
|
+
'max-classes-per-file': ['error', 1],
|
|
40
|
+
'max-statements-per-line': 'error',
|
|
41
|
+
'multiline-comment-style': 'error',
|
|
42
|
+
'new-cap': ['error', { properties: true }],
|
|
43
|
+
'no-alert': 'error',
|
|
44
|
+
'no-array-constructor': 'error',
|
|
45
|
+
'no-async-promise-executor': 'error',
|
|
46
|
+
'no-await-in-loop': 'error',
|
|
47
|
+
'no-bitwise': 'error',
|
|
48
|
+
'no-buffer-constructor': 'error',
|
|
49
|
+
'no-caller': 'error',
|
|
50
|
+
'no-case-declarations': 'error',
|
|
51
|
+
'no-class-assign': 'error',
|
|
52
|
+
'no-compare-neg-zero': 'error',
|
|
53
|
+
'no-cond-assign': 'error',
|
|
54
|
+
'no-const-assign': 'error',
|
|
55
|
+
'no-constant-binary-expression': 'error',
|
|
56
|
+
'no-constant-condition': 'error',
|
|
57
|
+
'no-constructor-return': 'error',
|
|
58
|
+
'no-control-regex': 'error',
|
|
59
|
+
'no-debugger': 'error',
|
|
60
|
+
'no-delete-var': 'error',
|
|
61
|
+
'no-div-regex': 'error',
|
|
62
|
+
'no-dupe-args': 'error',
|
|
63
|
+
'no-dupe-class-members': 'error',
|
|
64
|
+
'no-dupe-else-if': 'error',
|
|
65
|
+
'no-dupe-keys': 'error',
|
|
66
|
+
'no-duplicate-case': 'error',
|
|
67
|
+
'no-duplicate-imports': 'error',
|
|
68
|
+
'no-empty': 'error',
|
|
69
|
+
'no-empty-character-class': 'error',
|
|
70
|
+
'no-empty-function': 'error',
|
|
71
|
+
'no-empty-pattern': 'error',
|
|
72
|
+
'no-empty-static-block': 'error',
|
|
73
|
+
'no-eval': 'error',
|
|
74
|
+
'no-ex-assign': 'error',
|
|
75
|
+
'no-extend-native': 'error',
|
|
76
|
+
'no-extra-bind': 'error',
|
|
77
|
+
'no-extra-boolean-cast': 'error',
|
|
78
|
+
'no-extra-label': 'error',
|
|
79
|
+
'no-fallthrough': 'error',
|
|
80
|
+
'no-func-assign': 'error',
|
|
81
|
+
'no-global-assign': 'error',
|
|
82
|
+
'no-implicit-coercion': 'error',
|
|
83
|
+
'no-implicit-globals': 'error',
|
|
84
|
+
'no-implied-eval': 'error',
|
|
85
|
+
'no-import-assign': 'error',
|
|
86
|
+
'no-inner-declarations': 'error',
|
|
87
|
+
'no-invalid-regexp': 'error',
|
|
88
|
+
'no-invalid-this': 'error',
|
|
89
|
+
'no-irregular-whitespace': 'error',
|
|
90
|
+
'no-iterator': 'error',
|
|
91
|
+
'no-label-var': 'error',
|
|
92
|
+
'no-labels': ['error', { allowLoop: true }],
|
|
93
|
+
'no-lone-blocks': 'error',
|
|
94
|
+
'no-loop-func': 'error',
|
|
95
|
+
'no-loss-of-precision': 'error',
|
|
96
|
+
'no-magic-numbers': [
|
|
97
|
+
'error',
|
|
98
|
+
{
|
|
99
|
+
detectObjects: true,
|
|
100
|
+
enforceConst: true,
|
|
101
|
+
ignore: [-1, 0, 1],
|
|
102
|
+
ignoreArrayIndexes: true,
|
|
103
|
+
ignoreClassFieldInitialValues: true,
|
|
104
|
+
ignoreDefaultValues: true,
|
|
105
|
+
},
|
|
106
|
+
],
|
|
107
|
+
'no-misleading-character-class': 'error',
|
|
108
|
+
'no-mixed-requires': 'error',
|
|
109
|
+
'no-multi-assign': 'error',
|
|
110
|
+
'no-multi-str': 'error',
|
|
111
|
+
'no-nested-ternary': 'error',
|
|
112
|
+
'no-new': 'error',
|
|
113
|
+
'no-new-func': 'error',
|
|
114
|
+
'no-new-native-nonconstructor': 'error',
|
|
115
|
+
'no-new-object': 'error',
|
|
116
|
+
'no-new-require': 'error',
|
|
117
|
+
'no-new-symbol': 'error',
|
|
118
|
+
'no-new-wrappers': 'error',
|
|
119
|
+
'no-nonoctal-decimal-escape': 'error',
|
|
120
|
+
'no-obj-calls': 'error',
|
|
121
|
+
'no-octal': 'error',
|
|
122
|
+
'no-octal-escape': 'error',
|
|
123
|
+
'no-path-concat': 'error',
|
|
124
|
+
'no-plusplus': 'error',
|
|
125
|
+
'no-process-env': 'error',
|
|
126
|
+
'no-process-exit': 'error',
|
|
127
|
+
'no-promise-executor-return': 'error',
|
|
128
|
+
'no-proto': 'error',
|
|
129
|
+
'no-prototype-builtins': 'error',
|
|
130
|
+
'no-redeclare': 'error',
|
|
131
|
+
'no-regex-spaces': 'error',
|
|
132
|
+
'no-restricted-globals': ['error', 'event'],
|
|
133
|
+
'no-restricted-syntax': ['error', 'WithStatement', "BinaryExpression[operator='in']"],
|
|
134
|
+
'no-return-assign': 'error',
|
|
135
|
+
'no-return-await': 'error',
|
|
136
|
+
'no-script-url': 'error',
|
|
137
|
+
'no-self-assign': 'error',
|
|
138
|
+
'no-self-compare': 'error',
|
|
139
|
+
'no-sequences': 'error',
|
|
140
|
+
'no-setter-return': 'error',
|
|
141
|
+
'no-shadow': ['error', { hoist: 'all' }],
|
|
142
|
+
'no-shadow-restricted-names': 'error',
|
|
143
|
+
'no-sparse-arrays': 'error',
|
|
144
|
+
'no-template-curly-in-string': 'error',
|
|
145
|
+
'no-this-before-super': 'error',
|
|
146
|
+
'no-throw-literal': 'error',
|
|
147
|
+
'no-undef': 'error',
|
|
148
|
+
'no-undef-init': 'error',
|
|
149
|
+
'no-underscore-dangle': [
|
|
150
|
+
'error',
|
|
151
|
+
{
|
|
152
|
+
allow: ['_', '_this', '_1', '_2', '_3', '_4', '_5', '_6', '_7', '_8', '_9'],
|
|
153
|
+
allowAfterSuper: true,
|
|
154
|
+
allowAfterThis: true,
|
|
155
|
+
allowAfterThisConstructor: true,
|
|
156
|
+
allowFunctionParams: false,
|
|
157
|
+
allowInArrayDestructuring: false,
|
|
158
|
+
enforceInClassFields: true,
|
|
159
|
+
enforceInMethodNames: true,
|
|
160
|
+
},
|
|
161
|
+
],
|
|
162
|
+
'no-unmodified-loop-condition': 'error',
|
|
163
|
+
'no-unneeded-ternary': 'error',
|
|
164
|
+
'no-unreachable': 'error',
|
|
165
|
+
'no-unreachable-loop': 'error',
|
|
166
|
+
'no-unsafe-finally': 'error',
|
|
167
|
+
'no-unsafe-negation': 'error',
|
|
168
|
+
'no-unsafe-optional-chaining': 'error',
|
|
169
|
+
'no-unused-expressions': 'error',
|
|
170
|
+
'no-unused-labels': 'error',
|
|
171
|
+
'no-unused-private-class-members': 'error',
|
|
172
|
+
'no-unused-vars': [
|
|
173
|
+
'error',
|
|
174
|
+
{
|
|
175
|
+
argsIgnorePattern: /^_\w*$/u.source,
|
|
176
|
+
caughtErrorsIgnorePattern: /^_\w*$/u.source,
|
|
177
|
+
varsIgnorePattern: /^(_\d*|React)$/u.source,
|
|
178
|
+
},
|
|
179
|
+
],
|
|
180
|
+
'no-use-before-define': 'error',
|
|
181
|
+
'no-useless-backreference': 'error',
|
|
182
|
+
'no-useless-call': 'error',
|
|
183
|
+
'no-useless-catch': 'error',
|
|
184
|
+
'no-useless-computed-key': ['error', { enforceForClassMembers: true }],
|
|
185
|
+
'no-useless-concat': 'error',
|
|
186
|
+
'no-useless-constructor': 'error',
|
|
187
|
+
'no-useless-escape': 'error',
|
|
188
|
+
'no-useless-rename': 'error',
|
|
189
|
+
'no-useless-return': 'error',
|
|
190
|
+
'no-var': 'error',
|
|
191
|
+
'no-void': 'error',
|
|
192
|
+
'no-with': 'error',
|
|
193
|
+
'object-shorthand': ['error', 'always', { avoidExplicitReturnArrows: true, avoidQuotes: true }],
|
|
194
|
+
'one-var': ['error', 'never'],
|
|
195
|
+
'operator-assignment': 'error',
|
|
196
|
+
'padding-line-between-statements': [
|
|
197
|
+
'error',
|
|
198
|
+
/* eslint-disable sort-keys -- Logically ordered */
|
|
199
|
+
{ blankLine: 'always', prev: 'directive', next: '*' },
|
|
200
|
+
{ blankLine: 'always', prev: 'function', next: 'function' },
|
|
201
|
+
/* eslint-enable sort-keys -- Restore */
|
|
202
|
+
],
|
|
203
|
+
'prefer-arrow-callback': 'error',
|
|
204
|
+
'prefer-const': 'error',
|
|
205
|
+
'prefer-destructuring': 'error',
|
|
206
|
+
'prefer-exponentiation-operator': 'error',
|
|
207
|
+
'prefer-numeric-literals': 'error',
|
|
208
|
+
'prefer-object-spread': 'error',
|
|
209
|
+
'prefer-promise-reject-errors': 'error',
|
|
210
|
+
'prefer-regex-literals': ['error', { disallowRedundantWrapping: true }],
|
|
211
|
+
'prefer-rest-params': 'error',
|
|
212
|
+
'prefer-spread': 'error',
|
|
213
|
+
'prefer-template': 'error',
|
|
214
|
+
radix: 'error',
|
|
215
|
+
'require-atomic-updates': 'error',
|
|
216
|
+
'require-unicode-regexp': 'error',
|
|
217
|
+
'require-yield': 'error',
|
|
218
|
+
'spaced-comment': 'error',
|
|
219
|
+
'symbol-description': 'error',
|
|
220
|
+
'use-isnan': 'error',
|
|
221
|
+
'valid-typeof': 'error',
|
|
222
|
+
'vars-on-top': 'error',
|
|
223
|
+
yoda: 'error',
|
|
224
|
+
},
|
|
225
|
+
|
|
226
|
+
...eslintCommentsPlugin.configs.recommended.rules,
|
|
227
|
+
'eslint-comments/no-unused-disable': 'error',
|
|
228
|
+
'eslint-comments/require-description': 'error',
|
|
229
|
+
|
|
230
|
+
...importPlugin.configs.recommended.rules,
|
|
231
|
+
'import/consistent-type-specifier-style': ['error', 'prefer-inline'],
|
|
232
|
+
'import/first': ['error', 'absolute-first'],
|
|
233
|
+
'import/newline-after-import': 'error',
|
|
234
|
+
'import/no-absolute-path': 'error',
|
|
235
|
+
'import/no-amd': 'error',
|
|
236
|
+
'import/no-anonymous-default-export': [
|
|
237
|
+
'error',
|
|
238
|
+
{ allowArray: true, allowCallExpression: true, allowLiteral: true, allowNew: true, allowObject: true },
|
|
239
|
+
],
|
|
240
|
+
'import/no-commonjs': 'error',
|
|
241
|
+
'import/no-cycle': ['error', { ignoreExternal: true }],
|
|
242
|
+
'import/no-duplicates': ['error', { 'prefer-inline': true }],
|
|
243
|
+
'import/no-dynamic-require': 'error',
|
|
244
|
+
'import/no-empty-named-blocks': 'error',
|
|
245
|
+
'import/no-extraneous-dependencies': 'error',
|
|
246
|
+
'import/no-mutable-exports': 'error',
|
|
247
|
+
'import/no-named-as-default-member': 'error',
|
|
248
|
+
'import/no-named-default': 'error',
|
|
249
|
+
'import/no-self-import': 'error',
|
|
250
|
+
'import/no-unresolved': ['error', { caseSensitiveStrict: true }],
|
|
251
|
+
'import/no-unused-modules': 'error',
|
|
252
|
+
'import/no-useless-path-segments': 'error',
|
|
253
|
+
'import/no-webpack-loader-syntax': 'error',
|
|
254
|
+
'import/order': [
|
|
255
|
+
'error',
|
|
256
|
+
{
|
|
257
|
+
alphabetize: { caseInsensitive: true, order: 'asc' },
|
|
258
|
+
groups: ['builtin', 'external', 'internal', 'parent', 'sibling', 'index'],
|
|
259
|
+
'newlines-between': 'always',
|
|
260
|
+
},
|
|
261
|
+
],
|
|
262
|
+
'import/prefer-default-export': 'error',
|
|
263
|
+
|
|
264
|
+
...jsdocPlugin.configs.recommended.rules,
|
|
265
|
+
'jsdoc/check-indentation': 'error',
|
|
266
|
+
'jsdoc/check-param-names': ['error', { checkDestructured: false }],
|
|
267
|
+
'jsdoc/check-syntax': 'error',
|
|
268
|
+
'jsdoc/match-description': ['error', { matchDescription: '[A-Z]', tags: { param: true, returns: true } }],
|
|
269
|
+
'jsdoc/no-bad-blocks': 'error',
|
|
270
|
+
'jsdoc/no-defaults': 'error',
|
|
271
|
+
'jsdoc/require-asterisk-prefix': 'error',
|
|
272
|
+
'jsdoc/require-jsdoc': 'off',
|
|
273
|
+
'jsdoc/require-param': [
|
|
274
|
+
'error',
|
|
275
|
+
{
|
|
276
|
+
checkConstructors: false,
|
|
277
|
+
checkDestructured: false,
|
|
278
|
+
ignoreWhenAllParamsMissing: true,
|
|
279
|
+
},
|
|
280
|
+
],
|
|
281
|
+
'jsdoc/require-returns': 'off',
|
|
282
|
+
'jsdoc/sort-tags': 'error',
|
|
283
|
+
'jsdoc/tag-lines': ['error', 'any', { startLines: 1 }],
|
|
284
|
+
|
|
285
|
+
...promisePlugin.configs.recommended.rules,
|
|
286
|
+
'promise/no-multiple-resolved': 'error',
|
|
287
|
+
|
|
288
|
+
...regexpPlugin.configs.recommended.rules,
|
|
289
|
+
'regexp/hexadecimal-escape': ['error', 'never'],
|
|
290
|
+
'regexp/letter-case': 'error',
|
|
291
|
+
'regexp/no-empty-character-class': 'error',
|
|
292
|
+
'regexp/no-extra-lookaround-assertions': 'error',
|
|
293
|
+
'regexp/no-misleading-capturing-group': 'error',
|
|
294
|
+
'regexp/no-misleading-unicode-character': 'error',
|
|
295
|
+
'regexp/no-missing-g-flag': 'error',
|
|
296
|
+
'regexp/no-octal': 'error',
|
|
297
|
+
'regexp/no-standalone-backslash': 'error',
|
|
298
|
+
'regexp/prefer-escape-replacement-dollar-char': 'error',
|
|
299
|
+
'regexp/prefer-named-backreference': 'error',
|
|
300
|
+
'regexp/prefer-named-replacement': 'error',
|
|
301
|
+
'regexp/prefer-quantifier': 'error',
|
|
302
|
+
'regexp/prefer-result-array-groups': 'error',
|
|
303
|
+
'regexp/unicode-escape': 'error',
|
|
304
|
+
'regexp/use-ignore-case': 'error',
|
|
305
|
+
|
|
306
|
+
...sonarjsPlugin.configs.recommended.rules,
|
|
307
|
+
'sonarjs/cognitive-complexity': 'off',
|
|
308
|
+
'sonarjs/max-switch-cases': 'off',
|
|
309
|
+
'sonarjs/no-inverted-boolean-check': 'error',
|
|
310
|
+
'sonarjs/no-nested-template-literals': 'off',
|
|
311
|
+
'sonarjs/no-small-switch': 'off',
|
|
312
|
+
'sonarjs/prefer-immediate-return': 'off',
|
|
313
|
+
'sonarjs/prefer-single-boolean-return': 'off',
|
|
314
|
+
|
|
315
|
+
...stylisticPlugin.configs['recommended-flat'].rules,
|
|
316
|
+
'@stylistic/arrow-parens': 'off',
|
|
317
|
+
'@stylistic/brace-style': 'off',
|
|
318
|
+
'@stylistic/indent': 'off',
|
|
319
|
+
'@stylistic/indent-binary-ops': 'off',
|
|
320
|
+
'@stylistic/jsx-indent-props': 'off',
|
|
321
|
+
'@stylistic/jsx-one-expression-per-line': 'off',
|
|
322
|
+
'@stylistic/jsx-wrap-multilines': 'off',
|
|
323
|
+
'@stylistic/member-delimiter-style': 'off',
|
|
324
|
+
'@stylistic/multiline-ternary': 'off',
|
|
325
|
+
'@stylistic/no-multiple-empty-line': 'off',
|
|
326
|
+
'@stylistic/operator-linebreak': 'off',
|
|
327
|
+
'@stylistic/padding-line-between-statements': [
|
|
328
|
+
'error',
|
|
329
|
+
/* eslint-disable sort-keys -- Logically ordered */
|
|
330
|
+
{ blankLine: 'always', prev: 'directive', next: '*' },
|
|
331
|
+
{ blankLine: 'always', prev: 'function', next: 'function' },
|
|
332
|
+
/* eslint-enable sort-keys -- Logically ordered */
|
|
333
|
+
],
|
|
334
|
+
'@stylistic/quote-props': 'off',
|
|
335
|
+
'@stylistic/quotes': 'off',
|
|
336
|
+
'@stylistic/semi': 'off',
|
|
337
|
+
|
|
338
|
+
...unicornPlugin.configs.recommended.rules,
|
|
339
|
+
'unicorn/filename-case': 'off',
|
|
340
|
+
'unicorn/no-null': 'off',
|
|
341
|
+
'unicorn/no-unsafe-regex': 'error',
|
|
342
|
+
'unicorn/prefer-event-target': 'error',
|
|
343
|
+
'unicorn/prefer-query-selector': 'off',
|
|
344
|
+
'unicorn/prevent-abbreviations': 'off',
|
|
345
|
+
'unicorn/require-post-message-target-origin': 'error',
|
|
346
|
+
} satisfies TSESLint.FlatConfig.Rules;
|