@hansevision/eslint-config 1.0.11 → 1.0.17
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 +6 -80
- package/dist/index.d.ts +3 -3
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +59 -38
- package/dist/index.js.map +1 -1
- package/package.json +10 -10
package/README.md
CHANGED
|
@@ -4,97 +4,23 @@ A shareable, opinionated ESLint configuration for TypeScript projects. (SPFX OnP
|
|
|
4
4
|
|
|
5
5
|
## Installation
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
Install the package and its peer dependencies:
|
|
8
8
|
|
|
9
9
|
```bash
|
|
10
|
-
npm install eslint@^
|
|
11
|
-
npm install gulp-eslint-new@^2.6.2 --save-dev
|
|
12
|
-
```
|
|
13
|
-
|
|
14
|
-
edit gulpfile.js
|
|
15
|
-
...
|
|
16
|
-
// disable tslint to use gulp-eslint-new
|
|
17
|
-
build.tslint.enabled = false;
|
|
18
|
-
|
|
19
|
-
const eslint = require('gulp-eslint-new');
|
|
20
|
-
...
|
|
21
|
-
|
|
22
|
-
```bash
|
|
23
|
-
|
|
24
|
-
npm install --save-dev @hansevision/eslint-config --legacy-peer-deps
|
|
25
|
-
|
|
26
|
-
also
|
|
27
|
-
npm install --save-dev eslint-plugin-sonarjs@^4.0.2 --legacy-peer-deps
|
|
10
|
+
npm install -D @hansevision/eslint-config eslint@^7.25.0 @typescript-eslint/eslint-plugin@6 @typescript-eslint/parser@6 eslint-plugin-sonarjs@^0.25.1
|
|
28
11
|
```
|
|
29
12
|
|
|
30
13
|
## Usage
|
|
31
14
|
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
```js
|
|
35
|
-
module.exports = {
|
|
36
|
-
extends: ["@hansevision/eslint-config"],
|
|
37
|
-
rules: {
|
|
38
|
-
// eigene Überschreibungen
|
|
39
|
-
"no-console": "warn",
|
|
40
|
-
},
|
|
41
|
-
};
|
|
42
|
-
```
|
|
43
|
-
|
|
44
|
-
### Or ESLint in .eslintrc.json
|
|
15
|
+
Create an `.eslintrc.json` file in your project root:
|
|
45
16
|
|
|
17
|
+
```json
|
|
46
18
|
{
|
|
47
|
-
"
|
|
19
|
+
"root": true,
|
|
20
|
+
"extends": ["@hansevision/eslint-config"]
|
|
48
21
|
}
|
|
49
|
-
|
|
50
|
-
### Or ESM import
|
|
51
|
-
|
|
52
|
-
```js
|
|
53
|
-
import base from "@hansevision/eslint-config";
|
|
54
|
-
|
|
55
|
-
export default {
|
|
56
|
-
...base,
|
|
57
|
-
// your project-specific overrides
|
|
58
|
-
};
|
|
59
22
|
```
|
|
60
23
|
|
|
61
|
-
## Available Configurations
|
|
62
|
-
|
|
63
|
-
| Export | Description |
|
|
64
|
-
| ------------------ | ----------------------------------------- |
|
|
65
|
-
| `default` / `base` | Recommended rules for TypeScript projects |
|
|
66
|
-
|
|
67
|
-
## Rules Overview
|
|
68
|
-
|
|
69
|
-
### Plugins
|
|
70
|
-
|
|
71
|
-
| Plugin | Purpose |
|
|
72
|
-
| -------------------- | --------------------------------------- |
|
|
73
|
-
| `@typescript-eslint` | TypeScript-aware lint rules |
|
|
74
|
-
| `sonarjs` | Code quality and smell detection |
|
|
75
|
-
| `check-file` | Enforce consistent file & folder naming |
|
|
76
|
-
|
|
77
|
-
### Base rules
|
|
78
|
-
|
|
79
|
-
| Rule | Severity | Notes |
|
|
80
|
-
| ------------------------------------------ | -------- | ------------------------------------------------- |
|
|
81
|
-
| `eslint:recommended` | — | ESLint built-in recommended rules |
|
|
82
|
-
| `plugin:@typescript-eslint/recommended` | — | typescript-eslint recommended rules |
|
|
83
|
-
| `plugin:sonarjs/recommended` | — | SonarJS recommended rules |
|
|
84
|
-
| `quotes` | error | Enforce double quotes |
|
|
85
|
-
| `no-var` | error | Disallow `var`, use `const`/`let` |
|
|
86
|
-
| `no-console` | error | Allow only `console.warn` and `console.error` |
|
|
87
|
-
| `no-debugger` | error | Disallow `debugger` statements |
|
|
88
|
-
| `eqeqeq` | error | Always require strict equality (`===`) |
|
|
89
|
-
| `curly` | error | Always require braces for control statements |
|
|
90
|
-
| `@typescript-eslint/no-explicit-any` | warn | Discourage use of `any` type |
|
|
91
|
-
| `@typescript-eslint/no-unused-vars` | error | Ignore variables/args prefixed with `_` |
|
|
92
|
-
| `@typescript-eslint/no-non-null-assertion` | warn | Discourage non-null assertions (`!`) |
|
|
93
|
-
| `sonarjs/no-duplicate-string` | error | Flag strings repeated ≥ 2 times |
|
|
94
|
-
| `sonarjs/max-lines` | error | Maximum 40 lines per file |
|
|
95
|
-
| `sonarjs/arrow-function-convention` | error | Require parentheses and braces in arrow functions |
|
|
96
|
-
| `check-file/folder-naming-convention` | error | `src/` subfolders must use camelCase |
|
|
97
|
-
|
|
98
24
|
## Development
|
|
99
25
|
|
|
100
26
|
```bash
|
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { Linter } from
|
|
2
|
-
export declare const base: Linter.Config;
|
|
3
|
-
export default base;
|
|
1
|
+
import type { Linter } from 'eslint';
|
|
2
|
+
export declare const base: Linter.Config;
|
|
3
|
+
export default base;
|
|
4
4
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAErC,eAAO,MAAM,IAAI,EAAE,MAAM,CAAC,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAErC,eAAO,MAAM,IAAI,EAAE,MAAM,CAAC,MAsDzB,CAAC;AAEF,eAAe,IAAI,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -1,39 +1,60 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.base = void 0;
|
|
4
|
-
exports.base = {
|
|
5
|
-
parser:
|
|
6
|
-
ignorePatterns: [
|
|
7
|
-
parserOptions: {
|
|
8
|
-
ecmaVersion: 2020,
|
|
9
|
-
sourceType:
|
|
10
|
-
},
|
|
11
|
-
plugins: [
|
|
12
|
-
extends: [
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
],
|
|
17
|
-
rules: {
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.base = void 0;
|
|
4
|
+
exports.base = {
|
|
5
|
+
parser: '@typescript-eslint/parser',
|
|
6
|
+
ignorePatterns: ['**/*.d.ts'],
|
|
7
|
+
parserOptions: {
|
|
8
|
+
ecmaVersion: 2020,
|
|
9
|
+
sourceType: 'module',
|
|
10
|
+
},
|
|
11
|
+
plugins: ['@typescript-eslint', 'sonarjs'],
|
|
12
|
+
extends: [
|
|
13
|
+
'eslint:recommended',
|
|
14
|
+
'plugin:@typescript-eslint/recommended',
|
|
15
|
+
'plugin:sonarjs/recommended',
|
|
16
|
+
],
|
|
17
|
+
rules: {
|
|
18
|
+
'sonarjs/max-lines': 'off',
|
|
19
|
+
'max-lines': 'off',
|
|
20
|
+
quotes: ['error', 'single'],
|
|
21
|
+
'no-console': ['error', { allow: ['warn', 'error'] }],
|
|
22
|
+
'no-var': 'error',
|
|
23
|
+
'@typescript-eslint/no-explicit-any': 'warn',
|
|
24
|
+
'@typescript-eslint/no-unused-vars': [
|
|
25
|
+
'error',
|
|
26
|
+
{ argsIgnorePattern: '^_', varsIgnorePattern: '^_' },
|
|
27
|
+
],
|
|
28
|
+
'@typescript-eslint/no-non-null-assertion': 'warn',
|
|
29
|
+
'no-debugger': 'error',
|
|
30
|
+
eqeqeq: ['error', 'always'],
|
|
31
|
+
curly: ['error', 'all'],
|
|
32
|
+
'arrow-parens': ['error', 'always'],
|
|
33
|
+
'arrow-body-style': ['error', 'always'],
|
|
34
|
+
'no-await-in-loop': 'error',
|
|
35
|
+
'no-self-compare': 'error',
|
|
36
|
+
complexity: ['error', { max: 10 }],
|
|
37
|
+
'default-case': 'error',
|
|
38
|
+
'default-case-last': 'error',
|
|
39
|
+
'func-style': ['error', 'declaration', { allowArrowFunctions: true }],
|
|
40
|
+
'init-declarations': ['error', 'always'],
|
|
41
|
+
'max-depth': ['error', { max: 4 }],
|
|
42
|
+
'max-lines-per-function': [
|
|
43
|
+
'error',
|
|
44
|
+
{ max: 100, skipBlankLines: true, skipComments: true },
|
|
45
|
+
],
|
|
46
|
+
'max-params': ['error', { max: 3 }],
|
|
47
|
+
'no-else-return': ['error', { allowElseIf: false }],
|
|
48
|
+
'no-eval': 'error',
|
|
49
|
+
'no-implicit-coercion': 'error',
|
|
50
|
+
'no-magic-numbers': [
|
|
51
|
+
'error',
|
|
52
|
+
{ ignore: [0, 1], ignoreArrayIndexes: true, enforceConst: true },
|
|
53
|
+
],
|
|
54
|
+
'no-return-await': 'error',
|
|
55
|
+
'no-shadow': ['error', { builtinGlobals: false, hoist: 'functions' }],
|
|
56
|
+
'require-await': 'error',
|
|
57
|
+
},
|
|
58
|
+
};
|
|
59
|
+
exports.default = exports.base;
|
|
39
60
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;AAEa,QAAA,IAAI,GAAkB;IACjC,MAAM,E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AiB,EAAE,OAAO;QAC1B,UAAU,EAAE,CAAC,OAAO,EAAE,EAAE,GAAG,EAAE,EAAE,EAAE,CAAC;QAClC,cAAc,EAAE,OAAO;QACvB,mBAAmB,EAAE,OAAO;QAC5B,YAAY,EAAE,CAAC,OAAO,EAAE,aAAa,EAAE,EAAE,mBAAmB,EAAE,IAAI,EAAE,CAAC;QACrE,mBAAmB,EAAE,CAAC,OAAO,EAAE,QAAQ,CAAC;QACxC,WAAW,EAAE,CAAC,OAAO,EAAE,EAAE,GAAG,EAAE,CAAC,EAAE,CAAC;QAClC,wBAAwB,EAAE;YACxB,OAAO;YACP,EAAE,GAAG,EAAE,GAAG,EAAE,cAAc,EAAE,IAAI,EAAE,YAAY,EAAE,IAAI,EAAE;SACvD;QACD,YAAY,EAAE,CAAC,OAAO,EAAE,EAAE,GAAG,EAAE,CAAC,EAAE,CAAC;QACnC,gBAAgB,EAAE,CAAC,OAAO,EAAE,EAAE,WAAW,EAAE,KAAK,EAAE,CAAC;QACnD,SAAS,EAAE,OAAO;QAClB,sBAAsB,EAAE,OAAO;QAC/B,kBAAkB,EAAE;YAClB,OAAO;YACP,EAAE,MAAM,EAAE,CAAC,CAAC,EAAE,CAAC,CAAC,EAAE,kBAAkB,EAAE,IAAI,EAAE,YAAY,EAAE,IAAI,EAAE;SACjE;QACD,iBAAiB,EAAE,OAAO;QAC1B,WAAW,EAAE,CAAC,OAAO,EAAE,EAAE,cAAc,EAAE,KAAK,EAAE,KAAK,EAAE,WAAW,EAAE,CAAC;QACrE,eAAe,EAAE,OAAO;KACzB;CACF,CAAC;AAEF,kBAAe,YAAI,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@hansevision/eslint-config",
|
|
3
3
|
"author": "HanseVision",
|
|
4
|
-
"version": "1.0.
|
|
4
|
+
"version": "1.0.17",
|
|
5
5
|
"description": "Shareable ESLint configuration with TypeScript support",
|
|
6
6
|
"keywords": [],
|
|
7
7
|
"license": "UNLICENSED",
|
|
@@ -25,18 +25,18 @@
|
|
|
25
25
|
"prepublishOnly": "npm run build"
|
|
26
26
|
},
|
|
27
27
|
"peerDependencies": {
|
|
28
|
-
"eslint": "
|
|
29
|
-
"@typescript-eslint/eslint-plugin": "
|
|
30
|
-
"@typescript-eslint/parser": "
|
|
31
|
-
"eslint-plugin-sonarjs": "^
|
|
28
|
+
"eslint": "^7.25.0",
|
|
29
|
+
"@typescript-eslint/eslint-plugin": "6",
|
|
30
|
+
"@typescript-eslint/parser": "6",
|
|
31
|
+
"eslint-plugin-sonarjs": "^0.25.1"
|
|
32
32
|
},
|
|
33
33
|
"devDependencies": {
|
|
34
34
|
"@types/eslint": "^8.0.0",
|
|
35
|
-
"@typescript-eslint/eslint-plugin": "
|
|
36
|
-
"@typescript-eslint/parser": "
|
|
37
|
-
"eslint": "^
|
|
38
|
-
"eslint-plugin-sonarjs": "^
|
|
39
|
-
"typescript": "
|
|
35
|
+
"@typescript-eslint/eslint-plugin": "6",
|
|
36
|
+
"@typescript-eslint/parser": "6",
|
|
37
|
+
"eslint": "^7.25.0",
|
|
38
|
+
"eslint-plugin-sonarjs": "^0.25.1",
|
|
39
|
+
"typescript": "4"
|
|
40
40
|
},
|
|
41
41
|
"volta": {
|
|
42
42
|
"node": "16.20.2"
|