@sektek/eslint-plugin 1.0.1 → 2.0.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/.prettierrc.js +3 -0
- package/README.md +7 -8
- package/configs/recommended.js +77 -58
- package/configs/typescript.js +44 -15
- package/eslint.config.js +5 -0
- package/index.js +7 -4
- package/package.json +28 -17
package/.prettierrc.js
ADDED
package/README.md
CHANGED
|
@@ -8,17 +8,16 @@ npm install --save-dev eslint @sektek/eslint-plugin
|
|
|
8
8
|
|
|
9
9
|
## Setup
|
|
10
10
|
|
|
11
|
-
Extend the configs you want in your
|
|
11
|
+
Extend the configs you want in your `eslint.config.js` file:
|
|
12
12
|
|
|
13
13
|
```js
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
'plugin:@sektek/typescript',
|
|
17
|
-
],
|
|
18
|
-
};
|
|
19
|
-
```
|
|
14
|
+
import { defineConfig } from 'eslint/config';
|
|
15
|
+
import sektek from '@sektek/eslint-plugin';
|
|
20
16
|
|
|
21
|
-
|
|
17
|
+
export default defineConfig([
|
|
18
|
+
sektek.configs.recommended,
|
|
19
|
+
]);
|
|
20
|
+
```
|
|
22
21
|
|
|
23
22
|
## Rules
|
|
24
23
|
|
package/configs/recommended.js
CHANGED
|
@@ -1,62 +1,81 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
import { globalIgnores } from 'eslint/config';
|
|
2
|
+
import globals from 'globals';
|
|
3
|
+
|
|
4
|
+
import checkFile from 'eslint-plugin-check-file';
|
|
5
|
+
import importPlugin from 'eslint-plugin-import';
|
|
6
|
+
import js from '@eslint/js';
|
|
7
|
+
import jsdoc from 'eslint-plugin-jsdoc';
|
|
8
|
+
import mocha from 'eslint-plugin-mocha';
|
|
9
|
+
import prettier from 'eslint-plugin-prettier';
|
|
10
|
+
import prettierConfig from 'eslint-plugin-prettier/recommended';
|
|
11
|
+
import promise from 'eslint-plugin-promise';
|
|
12
|
+
import sonarjs from 'eslint-plugin-sonarjs';
|
|
13
|
+
|
|
14
|
+
export default [
|
|
15
|
+
globalIgnores(['node_modules/**', 'dist/**', 'coverage/**']),
|
|
16
|
+
{
|
|
17
|
+
extends: [
|
|
18
|
+
js.configs.recommended,
|
|
19
|
+
importPlugin.flatConfigs.recommended,
|
|
20
|
+
jsdoc.configs['flat/recommended'],
|
|
21
|
+
mocha.configs.recommended,
|
|
22
|
+
prettierConfig,
|
|
23
|
+
promise.configs['flat/recommended'],
|
|
24
|
+
sonarjs.configs.recommended,
|
|
25
|
+
],
|
|
26
|
+
plugins: {
|
|
27
|
+
'check-file': checkFile,
|
|
28
|
+
js,
|
|
29
|
+
mocha,
|
|
30
|
+
prettier,
|
|
31
|
+
},
|
|
32
|
+
languageOptions: {
|
|
33
|
+
globals: {
|
|
34
|
+
...globals.node,
|
|
35
|
+
...globals.mocha,
|
|
36
|
+
},
|
|
37
|
+
ecmaVersion: 'latest',
|
|
38
|
+
sourceType: 'module',
|
|
39
|
+
},
|
|
40
|
+
settings: {
|
|
41
|
+
'import/resolver': {
|
|
42
|
+
typescript: true,
|
|
43
|
+
},
|
|
44
|
+
},
|
|
45
|
+
rules: {
|
|
46
|
+
'check-file/filename-naming-convention': [
|
|
47
|
+
'error',
|
|
48
|
+
{ '**/*\\.{js,ts}': 'KEBAB_CASE' },
|
|
49
|
+
],
|
|
50
|
+
'import/newline-after-import': 'error',
|
|
51
|
+
'jsdoc/tag-lines': ['error', 'any', { startLines: 1, maxBlockLines: 1 }],
|
|
52
|
+
'mocha/no-exclusive-tests': 'error',
|
|
53
|
+
'no-console': 'error',
|
|
54
|
+
'no-eval': 'error',
|
|
55
|
+
'no-duplicate-imports': 'error',
|
|
56
|
+
'no-var': 'error',
|
|
57
|
+
'prefer-const': 'error',
|
|
58
|
+
'prefer-template': 'error',
|
|
59
|
+
'promise/prefer-await-to-callbacks': 'error',
|
|
60
|
+
'promise/prefer-await-to-then': 'error',
|
|
61
|
+
'sort-imports': ['error', { allowSeparatedGroups: true }],
|
|
62
|
+
yoda: 'error',
|
|
63
|
+
},
|
|
5
64
|
},
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
'plugin:eslint-comments/recommended',
|
|
11
|
-
'plugin:import/recommended',
|
|
12
|
-
'plugin:mocha/recommended',
|
|
13
|
-
'plugin:promise/recommended',
|
|
14
|
-
'plugin:sonarjs/recommended',
|
|
15
|
-
],
|
|
16
|
-
overrides: [
|
|
17
|
-
{
|
|
18
|
-
files: ['.eslintrc.js', '.eslintrc.cjs'],
|
|
19
|
-
rules: {
|
|
20
|
-
'filenames/match-regex': 'off',
|
|
21
|
-
}
|
|
65
|
+
{
|
|
66
|
+
files: ['eslint.config.js', '.*.js'],
|
|
67
|
+
rules: {
|
|
68
|
+
'check-file/filename-naming-convention': 'off',
|
|
22
69
|
},
|
|
23
|
-
{
|
|
24
|
-
files: ['*.spec.js', '*.spec.ts'],
|
|
25
|
-
rules: {
|
|
26
|
-
'sonarjs/no-identical-functions': 'off',
|
|
27
|
-
'sonarjs/no-duplicate-string': 'off',
|
|
28
|
-
'filenames/match-regex': 'off',
|
|
29
|
-
}
|
|
30
|
-
}
|
|
31
|
-
],
|
|
32
|
-
plugins: [
|
|
33
|
-
'eslint-comments',
|
|
34
|
-
'filenames',
|
|
35
|
-
'import',
|
|
36
|
-
'mocha',
|
|
37
|
-
'prettier',
|
|
38
|
-
'promise',
|
|
39
|
-
'sonarjs',
|
|
40
|
-
],
|
|
41
|
-
rules: {
|
|
42
|
-
'no-console': 'error',
|
|
43
|
-
'no-eval': 'error',
|
|
44
|
-
'no-duplicate-imports': 'error',
|
|
45
|
-
'no-var': 'error',
|
|
46
|
-
'prefer-const': 'error',
|
|
47
|
-
'prefer-template': 'error',
|
|
48
|
-
'sort-imports': 'error',
|
|
49
|
-
'yoda': 'error',
|
|
50
|
-
'filenames/match-regex': ['error', '^[a-z0-9-]+$'],
|
|
51
|
-
'promise/prefer-await-to-callbacks': 'error',
|
|
52
|
-
'promise/prefer-await-to-then': 'error',
|
|
53
|
-
'mocha/no-exclusive-tests': 'error',
|
|
54
70
|
},
|
|
55
|
-
|
|
56
|
-
'
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
71
|
+
{
|
|
72
|
+
files: ['**/*.spec.js', '**/*.spec.ts'],
|
|
73
|
+
rules: {
|
|
74
|
+
'check-file/filename-naming-convention': 'off',
|
|
75
|
+
'jsdoc/require-jsdoc': 'off',
|
|
76
|
+
'sonarjs/no-identical-functions': 'off',
|
|
77
|
+
'sonarjs/no-duplicate-string': 'off',
|
|
78
|
+
'sonarjs/no-clear-text-protocols': 'off',
|
|
60
79
|
},
|
|
61
|
-
}
|
|
62
|
-
|
|
80
|
+
},
|
|
81
|
+
];
|
package/configs/typescript.js
CHANGED
|
@@ -1,19 +1,48 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
1
|
+
import jsdoc from 'eslint-plugin-jsdoc';
|
|
2
|
+
import ts from 'typescript-eslint';
|
|
3
|
+
|
|
4
|
+
import recommended from './recommended.js';
|
|
5
|
+
|
|
6
|
+
export default [
|
|
7
|
+
...recommended,
|
|
8
|
+
...ts.configs.recommended,
|
|
9
|
+
{
|
|
10
|
+
extends: [jsdoc.configs['flat/recommended-typescript']],
|
|
11
|
+
settings: {
|
|
12
|
+
'import/resolver': {
|
|
13
|
+
typescript: {
|
|
14
|
+
alwaysTryTypes: true,
|
|
15
|
+
},
|
|
12
16
|
},
|
|
13
17
|
},
|
|
14
18
|
},
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
19
|
+
{
|
|
20
|
+
files: ['**/*.cjs'],
|
|
21
|
+
rules: {
|
|
22
|
+
'@typescript-eslint/no-require-imports': 'off',
|
|
23
|
+
},
|
|
24
|
+
},
|
|
25
|
+
{
|
|
26
|
+
rules: {
|
|
27
|
+
'no-unused-vars': 'off',
|
|
28
|
+
'@typescript-eslint/no-unused-vars': 'error',
|
|
29
|
+
'@typescript-eslint/no-empty-object-type': [
|
|
30
|
+
'error',
|
|
31
|
+
{ allowInterfaces: 'always' },
|
|
32
|
+
],
|
|
33
|
+
},
|
|
34
|
+
},
|
|
35
|
+
{
|
|
36
|
+
files: ['globals.d.ts'],
|
|
37
|
+
rules: {
|
|
38
|
+
'check-file/filename-naming-convention': 'off',
|
|
39
|
+
},
|
|
40
|
+
},
|
|
41
|
+
{
|
|
42
|
+
files: ['**/*.spec.ts'],
|
|
43
|
+
rules: {
|
|
44
|
+
'@typescript-eslint/no-unused-expressions': 'off',
|
|
45
|
+
'jsdoc/require-jsdoc': 'off',
|
|
46
|
+
},
|
|
18
47
|
},
|
|
19
|
-
|
|
48
|
+
];
|
package/eslint.config.js
ADDED
package/index.js
CHANGED
|
@@ -1,6 +1,9 @@
|
|
|
1
|
-
|
|
1
|
+
import recommended from './configs/recommended.js';
|
|
2
|
+
import typescript from './configs/typescript.js';
|
|
3
|
+
|
|
4
|
+
export default {
|
|
2
5
|
configs: {
|
|
3
|
-
recommended
|
|
4
|
-
typescript
|
|
6
|
+
recommended,
|
|
7
|
+
typescript,
|
|
5
8
|
},
|
|
6
|
-
}
|
|
9
|
+
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sektek/eslint-plugin",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "2.0.0",
|
|
4
4
|
"description": "Eslint configuration for all @sektek projects",
|
|
5
5
|
"author": "Edward Kelly <eddie@sektek.net>",
|
|
6
6
|
"repository": {
|
|
@@ -9,27 +9,38 @@
|
|
|
9
9
|
},
|
|
10
10
|
"license": "MIT",
|
|
11
11
|
"private": false,
|
|
12
|
-
"type": "
|
|
12
|
+
"type": "module",
|
|
13
13
|
"main": "index.js",
|
|
14
|
-
"scripts": {
|
|
14
|
+
"scripts": {
|
|
15
|
+
"lint": "eslint ."
|
|
16
|
+
},
|
|
15
17
|
"dependencies": {
|
|
16
|
-
"@sektek/prettier-config": "^
|
|
17
|
-
"@typescript-eslint/
|
|
18
|
-
"
|
|
19
|
-
"eslint
|
|
20
|
-
"eslint-
|
|
21
|
-
"eslint-
|
|
22
|
-
"eslint-plugin-
|
|
23
|
-
"eslint-plugin-import": "^2.
|
|
24
|
-
"eslint-plugin-
|
|
25
|
-
"eslint-plugin-
|
|
26
|
-
"eslint-plugin-
|
|
27
|
-
"eslint-plugin-
|
|
18
|
+
"@sektek/prettier-config": "^2",
|
|
19
|
+
"@typescript-eslint/parser": "^8.48.1",
|
|
20
|
+
"eslint": "^9.39.1",
|
|
21
|
+
"@eslint/js": "^9.39.1",
|
|
22
|
+
"eslint-config-prettier": "^10.1.8",
|
|
23
|
+
"eslint-import-resolver-typescript": "^4.4.4",
|
|
24
|
+
"eslint-plugin-check-file": "^3.3.1",
|
|
25
|
+
"eslint-plugin-import": "^2.32.0",
|
|
26
|
+
"eslint-plugin-jsdoc": "^62.5.4",
|
|
27
|
+
"eslint-plugin-mocha": "^11.2.0",
|
|
28
|
+
"eslint-plugin-prettier": "^5.5.4",
|
|
29
|
+
"eslint-plugin-promise": "^7.2.1",
|
|
30
|
+
"eslint-plugin-sonarjs": "^3.0.5",
|
|
31
|
+
"globals": "^14.0.0",
|
|
32
|
+
"prettier": "^3",
|
|
33
|
+
"typescript-eslint": "8.48.1"
|
|
28
34
|
},
|
|
29
35
|
"devDependencies": {
|
|
30
36
|
"@semantic-release/git": "^10.0.1",
|
|
31
|
-
"
|
|
32
|
-
"
|
|
37
|
+
"c8": "^10.1.3",
|
|
38
|
+
"semantic-release": "^25.0.2"
|
|
39
|
+
},
|
|
40
|
+
"peerDependencies": {
|
|
41
|
+
"@eslint/js": ">=9.39.1",
|
|
42
|
+
"eslint": ">=9.39.1",
|
|
43
|
+
"prettier": ">=3"
|
|
33
44
|
},
|
|
34
45
|
"prettier": "@sektek/prettier-config"
|
|
35
46
|
}
|