@hansevision/eslint-config 1.0.10 → 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 CHANGED
@@ -1,84 +1,26 @@
1
1
  # @hansevision/eslint-config
2
2
 
3
- A shareable, opinionated ESLint configuration for TypeScript projects.
3
+ A shareable, opinionated ESLint configuration for TypeScript projects. (SPFX OnPrem)
4
4
 
5
5
  ## Installation
6
6
 
7
- ```bash
8
- npm install --save-dev @hansevision/eslint-config --legacy-peer-deps
7
+ Install the package and its peer dependencies:
9
8
 
10
- also
11
- npm install --save-dev eslint-plugin-sonarjs@^4.0.2 --legacy-peer-deps
9
+ ```bash
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
12
11
  ```
13
12
 
14
13
  ## Usage
15
14
 
16
- ### ESLint v8 (`.eslintrc.js`)
17
-
18
- ```js
19
- module.exports = {
20
- extends: ["@hansevision/eslint-config"],
21
- rules: {
22
- // eigene Überschreibungen
23
- "no-console": "warn",
24
- },
25
- };
26
- ```
27
-
28
- ### Or ESLint in .eslintrc.json
15
+ Create an `.eslintrc.json` file in your project root:
29
16
 
17
+ ```json
30
18
  {
31
- "extends": ["@hansevision/eslint-config"]
19
+ "root": true,
20
+ "extends": ["@hansevision/eslint-config"]
32
21
  }
33
-
34
- ### Or ESM import
35
-
36
- ```js
37
- import base from "@hansevision/eslint-config";
38
-
39
- export default {
40
- ...base,
41
- // your project-specific overrides
42
- };
43
22
  ```
44
23
 
45
- ## Available Configurations
46
-
47
- | Export | Description |
48
- | ------------------ | ----------------------------------------- |
49
- | `default` / `base` | Recommended rules for TypeScript projects |
50
-
51
- ## Rules Overview
52
-
53
- ### Plugins
54
-
55
- | Plugin | Purpose |
56
- | -------------------- | --------------------------------------- |
57
- | `@typescript-eslint` | TypeScript-aware lint rules |
58
- | `sonarjs` | Code quality and smell detection |
59
- | `check-file` | Enforce consistent file & folder naming |
60
-
61
- ### Base rules
62
-
63
- | Rule | Severity | Notes |
64
- | ------------------------------------------ | -------- | ------------------------------------------------- |
65
- | `eslint:recommended` | — | ESLint built-in recommended rules |
66
- | `plugin:@typescript-eslint/recommended` | — | typescript-eslint recommended rules |
67
- | `plugin:sonarjs/recommended` | — | SonarJS recommended rules |
68
- | `quotes` | error | Enforce double quotes |
69
- | `no-var` | error | Disallow `var`, use `const`/`let` |
70
- | `no-console` | error | Allow only `console.warn` and `console.error` |
71
- | `no-debugger` | error | Disallow `debugger` statements |
72
- | `eqeqeq` | error | Always require strict equality (`===`) |
73
- | `curly` | error | Always require braces for control statements |
74
- | `@typescript-eslint/no-explicit-any` | warn | Discourage use of `any` type |
75
- | `@typescript-eslint/no-unused-vars` | error | Ignore variables/args prefixed with `_` |
76
- | `@typescript-eslint/no-non-null-assertion` | warn | Discourage non-null assertions (`!`) |
77
- | `sonarjs/no-duplicate-string` | error | Flag strings repeated ≥ 2 times |
78
- | `sonarjs/max-lines` | error | Maximum 40 lines per file |
79
- | `sonarjs/arrow-function-convention` | error | Require parentheses and braces in arrow functions |
80
- | `check-file/folder-naming-convention` | error | `src/` subfolders must use camelCase |
81
-
82
24
  ## Development
83
25
 
84
26
  ```bash
package/dist/index.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import type { Linter } from "eslint";
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
@@ -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,MAoCzB,CAAC;AAEF,eAAe,IAAI,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,42 +1,60 @@
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-legacy",
16
- ],
17
- rules: {
18
- quotes: ["error", "double"],
19
- "no-console": ["error", { allow: ["warn", "error"] }],
20
- "no-var": "error",
21
- "@typescript-eslint/no-explicit-any": "warn",
22
- "@typescript-eslint/no-unused-vars": [
23
- "error",
24
- { argsIgnorePattern: "^_", varsIgnorePattern: "^_" },
25
- ],
26
- "@typescript-eslint/no-non-null-assertion": "warn",
27
- "no-debugger": "error",
28
- eqeqeq: ["error", "always"],
29
- curly: ["error", "all"],
30
- "max-lines": [
31
- "error",
32
- { max: 40, skipBlankLines: true, skipComments: true },
33
- ],
34
- "sonarjs/no-duplicate-string": ["error", { threshold: 2 }],
35
- "sonarjs/arrow-function-convention": [
36
- "error",
37
- { requireParameterParentheses: true, requireBodyBraces: true },
38
- ],
39
- },
40
- };
41
- exports.default = exports.base;
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;
42
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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AAc,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.10",
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": ">=7.0.0",
29
- "@typescript-eslint/eslint-plugin": ">=5.0.0",
30
- "@typescript-eslint/parser": ">=5.0.0",
31
- "eslint-plugin-sonarjs": "^4.0.2"
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": "^5.62.0",
36
- "@typescript-eslint/parser": "^5.62.0",
37
- "eslint": "^8.57.1",
38
- "eslint-plugin-sonarjs": "^4.0.2",
39
- "typescript": "^3.9.10"
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"