eslint-config-beslogic 1.4.21 → 1.4.22
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 +1 -0
- package/.vscode/extensions.json +17 -17
- package/.vscode/settings.json +10 -3
- package/README.md +14 -4
- package/angular.js +7 -5
- package/dprint-base.json +3 -2
- package/dprint.js +1 -0
- package/index.js +1 -0
- package/javascript.js +8 -2
- package/jest.js +8 -0
- package/json-like.js +7 -0
- package/mui.js +1 -0
- package/node-js.js +1 -0
- package/package.json +3 -4
- package/react-native.js +1 -0
- package/react-redux.js +1 -0
- package/react.js +1 -0
- package/rxjs.js +1 -0
- package/storybook.js +1 -0
- package/typescript.js +4 -4
- package/.gitignore.npmignore +0 -2
package/.eslintrc.js
CHANGED
package/.vscode/extensions.json
CHANGED
|
@@ -4,7 +4,6 @@
|
|
|
4
4
|
// Please keep in alphabetical order
|
|
5
5
|
{
|
|
6
6
|
// See https://go.microsoft.com/fwlink/?LinkId=827846 to learn about workspace recommendations.
|
|
7
|
-
// Extension identifier format: ${publisher}.${name}. Example: vscode.csharp
|
|
8
7
|
// List of extensions which should be recommended for users of this workspace.
|
|
9
8
|
// Only keep those used by your specific project
|
|
10
9
|
"recommendations": [
|
|
@@ -12,30 +11,31 @@
|
|
|
12
11
|
"davidanson.vscode-markdownlint",
|
|
13
12
|
"dbaeumer.vscode-eslint",
|
|
14
13
|
"dprint.dprint",
|
|
15
|
-
"dotenv.dotenv-vscode",
|
|
14
|
+
// "dotenv.dotenv-vscode",
|
|
16
15
|
"eamodio.gitlens",
|
|
17
|
-
"firsttris.vscode-jest-runner",
|
|
16
|
+
// "firsttris.vscode-jest-runner",
|
|
18
17
|
// "johnpapa.angular2",
|
|
19
18
|
"meganrogge.template-string-converter",
|
|
20
|
-
"ms-vscode.vscode-typescript-next",
|
|
21
19
|
"pkief.material-icon-theme"
|
|
20
|
+
// "redhat.vscode-xml",
|
|
21
|
+
// "redhat.vscode-yaml"
|
|
22
22
|
],
|
|
23
23
|
// List of extensions recommended by VS Code that should not be recommended for users of this workspace.
|
|
24
|
+
// Developpers should uninstall or disable the following extensions for this workspace
|
|
25
|
+
// https://github.com/microsoft/vscode/issues/40239
|
|
24
26
|
"unwantedRecommendations": [
|
|
25
|
-
// VSCode
|
|
26
|
-
"
|
|
27
|
-
//
|
|
28
|
-
"
|
|
29
|
-
//
|
|
30
|
-
"
|
|
31
|
-
//
|
|
32
|
-
|
|
33
|
-
// The ESLint plugin is sufficient in JS/TS projects
|
|
34
|
-
"sonarsource.sonarlint-vscode",
|
|
35
|
-
// Everything below is Deprecated or obsoleted
|
|
27
|
+
"dotjoshjohnson.xml", // Prevent VSCode from recommending a different XML extension than the one we recommend
|
|
28
|
+
"esbenp.prettier-vscode", // Lots of conflicts
|
|
29
|
+
"ms-vscode.vscode-typescript-next", // Use workspace version instead
|
|
30
|
+
"mikestead.dotenv", // Use the official plugin instead
|
|
31
|
+
"orta.vscode-jest", // firsttris.vscode-jest-runner is preferable and doesn't have issues with parametrized tests
|
|
32
|
+
"rvest.vs-code-prettier-eslint", // Lots of conflicts
|
|
33
|
+
"sonarsource.sonarlint-vscode", // Not project-configurable. And the ESLint plugin is sufficient in JS/TS projects
|
|
34
|
+
// Everything below is Deprecated
|
|
36
35
|
"coenraads.bracket-pair-colorizer",
|
|
36
|
+
"coenraads.bracket-pair-colorizer-2",
|
|
37
37
|
"eg2.tslint",
|
|
38
|
-
"
|
|
39
|
-
"
|
|
38
|
+
"ms-vscode.vscode-typescript-tslint-plugin",
|
|
39
|
+
"simonsiefke.prettier-vscode"
|
|
40
40
|
]
|
|
41
41
|
}
|
package/.vscode/settings.json
CHANGED
|
@@ -4,8 +4,7 @@
|
|
|
4
4
|
{
|
|
5
5
|
"files.associations": {
|
|
6
6
|
".eslintrc*.json": "jsonc",
|
|
7
|
-
"dprint*.json": "jsonc"
|
|
8
|
-
"tsconfig*.json": "jsonc"
|
|
7
|
+
"dprint*.json": "jsonc"
|
|
9
8
|
},
|
|
10
9
|
"editor.rulers": [
|
|
11
10
|
80,
|
|
@@ -39,6 +38,7 @@
|
|
|
39
38
|
// },
|
|
40
39
|
"editor.codeActionsOnSave": {
|
|
41
40
|
"source.fixAll": true,
|
|
41
|
+
// Let dedicated imports tool deal with it
|
|
42
42
|
"source.organizeImports": false
|
|
43
43
|
},
|
|
44
44
|
"typescript.tsdk": "node_modules/typescript/lib",
|
|
@@ -66,6 +66,11 @@
|
|
|
66
66
|
"mode": "auto"
|
|
67
67
|
}
|
|
68
68
|
],
|
|
69
|
+
"eslint.codeActionsOnSave.rules": [
|
|
70
|
+
// Clearing imports because of commented code while testing is annoying
|
|
71
|
+
"!unused-imports/no-unused-imports",
|
|
72
|
+
"*"
|
|
73
|
+
],
|
|
69
74
|
"eslint.rules.customizations": [
|
|
70
75
|
{
|
|
71
76
|
"rule": "*",
|
|
@@ -95,5 +100,7 @@
|
|
|
95
100
|
"package-lock.json": true,
|
|
96
101
|
"*.lock": true
|
|
97
102
|
},
|
|
98
|
-
"editor.bracketPairColorization.enabled": true
|
|
103
|
+
"editor.bracketPairColorization.enabled": true,
|
|
104
|
+
"xml.codeLens.enabled": true,
|
|
105
|
+
"xml.format.maxLineWidth": 120
|
|
99
106
|
}
|
package/README.md
CHANGED
|
@@ -13,6 +13,16 @@ A [dprint preset](#beslogicdprint) is ofered below.
|
|
|
13
13
|
|
|
14
14
|
## Parallel configurations
|
|
15
15
|
|
|
16
|
+
Add the following scripts to your `package.json`:
|
|
17
|
+
|
|
18
|
+
```json
|
|
19
|
+
"scripts": {
|
|
20
|
+
"eslint": "eslint ./ --ignore-path .gitignore",
|
|
21
|
+
"lint": "dprint check && npm run eslint",
|
|
22
|
+
"lint:fix": "dprint fmt && npm run eslint -- --fix",
|
|
23
|
+
}
|
|
24
|
+
```
|
|
25
|
+
|
|
16
26
|
These are configuration files you'll have to update manually to best work with these presets.
|
|
17
27
|
|
|
18
28
|
- [VSCode Settings and Extensions](https://socket.dev/npm/package/eslint-config-beslogic/files/latest/.vscode)
|
|
@@ -38,13 +48,13 @@ Default preset, extends from `beslogic/javascript` and `beslogic/typescript`.
|
|
|
38
48
|
|
|
39
49
|
### `beslogic/javascript`
|
|
40
50
|
|
|
41
|
-
Basic javascript configs, is extended by all other configs except `beslogic/typescript` and `beslogic/json-like`.
|
|
51
|
+
Basic javascript configs, is extended by all other configs except `beslogic/typescript`, `beslogic/jest`, `beslogic/storybook` and `beslogic/json-like`.
|
|
42
52
|
|
|
43
53
|
### `beslogic/typescript`
|
|
44
54
|
|
|
45
|
-
Basic TypeScript-specific configs and `TSX` support, is extended by all other TypeScript exclusive configs. To avoid rules conflicts, it does **not** already extend from `beslogic/javascript`. So you should extend from both in a pure TypeScript project. You may also need to specify `parserOptions.project`. ie: `"parserOptions": { "project": ["tsconfig.json"] },` and `"parser": "@typescript-eslint/parser"
|
|
55
|
+
Basic TypeScript-specific configs and `TSX` support, is extended by all other TypeScript exclusive configs. To avoid rules conflicts, it does **not** already extend from `beslogic/javascript`. So you should extend from both in a pure TypeScript project. You may also need to specify `parserOptions.project`. ie: `"parserOptions": { "project": ["tsconfig.json"] },` and `"parser": "@typescript-eslint/parser"`.
|
|
46
56
|
|
|
47
|
-
For the linting to be fully effective, please make sure to set the following in your `tsconfig.json`:
|
|
57
|
+
For the linting to be fully effective, please make sure to set the following in your base `tsconfig.json`:
|
|
48
58
|
|
|
49
59
|
<!-- dprint-ignore -->
|
|
50
60
|
```json
|
|
@@ -145,7 +155,7 @@ Add the following `devDependencies` to your `package.json`:
|
|
|
145
155
|
|
|
146
156
|
Configurations for NGX projects. Comes with `html` template and inline template support. Already extends `beslogic/rxjs` and `beslogic/typescript`. Also extends `beslogic/node-js` for Javascript files.
|
|
147
157
|
|
|
148
|
-
For the linting to be fully effective, please make sure to set the following in your `tsconfig.json`:
|
|
158
|
+
For the linting to be fully effective, please make sure to set the following in your base `tsconfig.json`:
|
|
149
159
|
|
|
150
160
|
<!-- dprint-ignore -->
|
|
151
161
|
```jsonc
|
package/angular.js
CHANGED
|
@@ -53,6 +53,8 @@ const baseIgnoreAttributes = [
|
|
|
53
53
|
"width",
|
|
54
54
|
"xmlns"
|
|
55
55
|
]
|
|
56
|
+
|
|
57
|
+
/** @type {import("eslint").Linter.Config} */
|
|
56
58
|
module.exports = {
|
|
57
59
|
"overrides": [
|
|
58
60
|
{
|
|
@@ -83,7 +85,8 @@ module.exports = {
|
|
|
83
85
|
],
|
|
84
86
|
"@angular-eslint/template/i18n": "off",
|
|
85
87
|
"no-autofix/@angular-eslint/template/i18n": [
|
|
86
|
-
"error"
|
|
88
|
+
// Too many TODO and needs per-project extensions to justify this as "error"
|
|
89
|
+
"warn",
|
|
87
90
|
{
|
|
88
91
|
// TODO: doesn't work for text elements.
|
|
89
92
|
// see: https://github.com/angular-eslint/angular-eslint/issues/999
|
|
@@ -129,11 +132,10 @@ module.exports = {
|
|
|
129
132
|
],
|
|
130
133
|
"parserOptions": {
|
|
131
134
|
"project": [
|
|
132
|
-
"tsconfig.json",
|
|
133
|
-
"tsconfig
|
|
134
|
-
"projects/*/tsconfig.*.json",
|
|
135
|
+
"tsconfig?(.*).json",
|
|
136
|
+
"projects/*/tsconfig?(.*).json",
|
|
135
137
|
// eslint-disable-next-line etc/no-commented-out-code
|
|
136
|
-
"*/tsconfig.json" // e2e/tsconfig.json
|
|
138
|
+
"*/tsconfig?(.*).json" // e2e/tsconfig.json
|
|
137
139
|
],
|
|
138
140
|
// TODO: Consider use a tsconfig.eslint.json instead
|
|
139
141
|
// https://github.com/typescript-eslint/typescript-eslint/blob/main/packages/parser/README.md#parseroptionscreatedefaultprogram
|
package/dprint-base.json
CHANGED
|
@@ -8,15 +8,16 @@
|
|
|
8
8
|
// "quoteStyle": "alwaysDouble", // If using beslogic/json-like
|
|
9
9
|
"quoteProps": "asNeeded", // If NOT using beslogic/json-like
|
|
10
10
|
// "quoteProps": "preserve", // If using beslogic/json-like
|
|
11
|
+
// "trailingCommas": "never", // If using beslogic/json-like
|
|
11
12
|
"newLineKind": "auto",
|
|
12
|
-
"semiColons": "asi",
|
|
13
|
+
"semiColons": "asi",
|
|
13
14
|
"operatorPosition": "sameLine",
|
|
14
15
|
"conditionalExpression.operatorPosition": "nextLine",
|
|
15
16
|
"arrowFunction.useParentheses": "preferNone",
|
|
16
17
|
"binaryExpression.linePerExpression": true,
|
|
17
18
|
// Not convinced yet
|
|
18
19
|
// "memberExpression.linePerExpression": true,
|
|
19
|
-
"typeLiteral.separatorKind": "comma",
|
|
20
|
+
"typeLiteral.separatorKind": "comma",
|
|
20
21
|
"enumDeclaration.memberSpacing": "newLine",
|
|
21
22
|
"importDeclaration.forceSingleLine": true,
|
|
22
23
|
// conflicts with simple-import-sort/imports
|
package/dprint.js
CHANGED
package/index.js
CHANGED
package/javascript.js
CHANGED
|
@@ -31,6 +31,7 @@ const idLenghtConfig = {
|
|
|
31
31
|
]
|
|
32
32
|
}
|
|
33
33
|
|
|
34
|
+
/** @type {import("eslint").Linter.Config} */
|
|
34
35
|
module.exports = {
|
|
35
36
|
"plugins": [
|
|
36
37
|
"extra-rules",
|
|
@@ -85,6 +86,11 @@ module.exports = {
|
|
|
85
86
|
".test.jsx"
|
|
86
87
|
],
|
|
87
88
|
"extends": ["./jest"]
|
|
89
|
+
},
|
|
90
|
+
{
|
|
91
|
+
"files": [".eslintrc.js"],
|
|
92
|
+
"globals": { "module": true },
|
|
93
|
+
"extends": ["./json-like"]
|
|
88
94
|
}
|
|
89
95
|
],
|
|
90
96
|
"rules": {
|
|
@@ -94,8 +100,8 @@ module.exports = {
|
|
|
94
100
|
// unused-imports settings
|
|
95
101
|
// Loosing imports when commenting to test is extremely annoying and slow,
|
|
96
102
|
// so we only use this rule when ran from the command-line
|
|
97
|
-
// no-autofix/unused-imports is redundant with no-unused-vars
|
|
98
|
-
"unused-imports/no-unused-imports": "
|
|
103
|
+
// no-autofix/unused-imports is redundant with no-unused-vars and and eslint.codeActionsOnSave.rules
|
|
104
|
+
"unused-imports/no-unused-imports": "warn",
|
|
99
105
|
|
|
100
106
|
// unicorn/all overrides (https://github.com/sindresorhus/eslint-plugin-unicorn#rules)
|
|
101
107
|
"unicorn/catch-error-name": [
|
package/jest.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
// SPDX-License-Identifier: MIT
|
|
2
2
|
// Copyright 2023 Beslogic Inc.
|
|
3
3
|
|
|
4
|
+
/** @type {import("eslint").Linter.Config} */
|
|
4
5
|
module.exports = {
|
|
5
6
|
"extends": [
|
|
6
7
|
"plugin:jest/all",
|
|
@@ -12,6 +13,13 @@ module.exports = {
|
|
|
12
13
|
"jest": true,
|
|
13
14
|
"jest/globals": true
|
|
14
15
|
},
|
|
16
|
+
"overrides": [
|
|
17
|
+
{
|
|
18
|
+
"files": [".eslintrc.js"],
|
|
19
|
+
"globals": { "module": true },
|
|
20
|
+
"extends": ["./json-like"]
|
|
21
|
+
}
|
|
22
|
+
],
|
|
15
23
|
"rules": {
|
|
16
24
|
// Using only max-lines and not max-lines-per-function as most of the jest code lives in functions.
|
|
17
25
|
"max-lines-per-function": "off",
|
package/json-like.js
CHANGED
|
@@ -1,7 +1,14 @@
|
|
|
1
1
|
// SPDX-License-Identifier: MIT
|
|
2
2
|
// Copyright 2023 Beslogic Inc.
|
|
3
3
|
|
|
4
|
+
/** @type {import("eslint").Linter.Config} */
|
|
4
5
|
module.exports = {
|
|
6
|
+
"overrides": [
|
|
7
|
+
{
|
|
8
|
+
"files": [".eslintrc.js"],
|
|
9
|
+
"globals": { "module": true }
|
|
10
|
+
}
|
|
11
|
+
],
|
|
5
12
|
"rules": {
|
|
6
13
|
"array-bracket-newline": [
|
|
7
14
|
"error",
|
package/mui.js
CHANGED
|
@@ -10,6 +10,7 @@ const noMagicNumbersConfig = typeScriptConfig.overrides[0].rules["@typescript-es
|
|
|
10
10
|
if (typeof idLenghtConfig === "string") throw new TypeError("idLenghtConfig is a string")
|
|
11
11
|
if (typeof noMagicNumbersConfig === "string") throw new TypeError("noMagicNumbersConfig is a string")
|
|
12
12
|
|
|
13
|
+
/** @type {import("eslint").Linter.Config} */
|
|
13
14
|
module.exports = {
|
|
14
15
|
"plugins": ["mui"],
|
|
15
16
|
"extends": [
|
package/node-js.js
CHANGED
|
@@ -15,6 +15,7 @@ preventAbbreviationsConfig.allowList.res = true
|
|
|
15
15
|
preventAbbreviationsConfig.allowList.req = true
|
|
16
16
|
const expressGlobalMessage = "Import from express instead."
|
|
17
17
|
|
|
18
|
+
/** @type {import("eslint").Linter.Config} */
|
|
18
19
|
module.exports = {
|
|
19
20
|
"extends": [
|
|
20
21
|
"./javascript",
|
package/package.json
CHANGED
|
@@ -1,15 +1,14 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "eslint-config-beslogic",
|
|
3
|
-
"version": "1.4.
|
|
3
|
+
"version": "1.4.22",
|
|
4
4
|
"description": "ESLint rules, plugins and configs used at Beslogic",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"scripts": {
|
|
7
|
-
"eslint": "eslint ./ --ignore-path .gitignore
|
|
7
|
+
"eslint": "eslint ./ --ignore-path .gitignore",
|
|
8
8
|
"lint": "node ./node_modules/dprint/bin check && npm run eslint",
|
|
9
9
|
"lint:fix": "node ./node_modules/dprint/bin fmt && npm run eslint -- --fix",
|
|
10
10
|
"upgrade": "npx npm-check-updates -u & npm i",
|
|
11
|
-
"yalc": "yalc publish"
|
|
12
|
-
"prepack": "type .gitignore* > .npmignore"
|
|
11
|
+
"yalc": "yalc publish"
|
|
13
12
|
},
|
|
14
13
|
"keywords": [
|
|
15
14
|
"eslint",
|
package/react-native.js
CHANGED
package/react-redux.js
CHANGED
package/react.js
CHANGED
package/rxjs.js
CHANGED
package/storybook.js
CHANGED
package/typescript.js
CHANGED
|
@@ -24,6 +24,7 @@ const getModuleVersion = nodeModule =>
|
|
|
24
24
|
// I already checked for dynamic rules up to v5.23.0
|
|
25
25
|
const typescriptEslintVersion = getModuleVersion("@typescript-eslint/eslint-plugin")
|
|
26
26
|
|
|
27
|
+
/** @type {import("eslint").Linter.Config} */
|
|
27
28
|
module.exports = {
|
|
28
29
|
"overrides": [
|
|
29
30
|
{
|
|
@@ -55,9 +56,8 @@ module.exports = {
|
|
|
55
56
|
// always try to resolve types under `<root>@types` directory even it doesn't contain any source code, like `@types/unist`
|
|
56
57
|
"alwaysTryTypes": true,
|
|
57
58
|
"project": [
|
|
58
|
-
"tsconfig.json",
|
|
59
|
-
"tsconfig
|
|
60
|
-
"projects/*/tsconfig.*.json"
|
|
59
|
+
"tsconfig?(.*).json",
|
|
60
|
+
"projects/*/tsconfig?(.*).json"
|
|
61
61
|
]
|
|
62
62
|
}
|
|
63
63
|
}
|
|
@@ -70,7 +70,7 @@ module.exports = {
|
|
|
70
70
|
},
|
|
71
71
|
"parser": "@typescript-eslint/parser",
|
|
72
72
|
"parserOptions": {
|
|
73
|
-
"project": ["tsconfig.json"],
|
|
73
|
+
"project": ["tsconfig?(.*).json"],
|
|
74
74
|
"sourceType": "module",
|
|
75
75
|
"ecmaFeatures": {
|
|
76
76
|
"impliedStrict": true
|
package/.gitignore.npmignore
DELETED