@tpluscode/eslint-config 0.6.4 → 1.0.1
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/.github/workflows/build.yml +2 -2
- package/.github/workflows/release.yml +7 -3
- package/CHANGELOG.md +12 -0
- package/README.md +21 -12
- package/eslint.config.js +12 -0
- package/index.js +46 -59
- package/js.js +123 -80
- package/package.json +32 -25
- package/.eslintrc.json +0 -3
|
@@ -5,6 +5,11 @@ on:
|
|
|
5
5
|
branches:
|
|
6
6
|
- master
|
|
7
7
|
|
|
8
|
+
permissions:
|
|
9
|
+
id-token: write
|
|
10
|
+
contents: write
|
|
11
|
+
pull-requests: write
|
|
12
|
+
|
|
8
13
|
concurrency: ${{ github.workflow }}-${{ github.ref }}
|
|
9
14
|
|
|
10
15
|
jobs:
|
|
@@ -13,9 +18,9 @@ jobs:
|
|
|
13
18
|
runs-on: ubuntu-latest
|
|
14
19
|
steps:
|
|
15
20
|
- name: Checkout Repo
|
|
16
|
-
uses: actions/checkout@
|
|
21
|
+
uses: actions/checkout@v6
|
|
17
22
|
|
|
18
|
-
- uses: actions/setup-node@
|
|
23
|
+
- uses: actions/setup-node@v6
|
|
19
24
|
with:
|
|
20
25
|
node-version: "lts/*"
|
|
21
26
|
|
|
@@ -30,4 +35,3 @@ jobs:
|
|
|
30
35
|
publish: yarn release
|
|
31
36
|
env:
|
|
32
37
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
33
|
-
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
|
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,17 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 1.0.1
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- 0e02d92: Ignore `n/no-unpublished-import` and `n/no-unpublished-require` in test sources
|
|
8
|
+
|
|
9
|
+
## 1.0.0
|
|
10
|
+
|
|
11
|
+
### Major Changes
|
|
12
|
+
|
|
13
|
+
- 4218648: Updated to eslint v9 flat config
|
|
14
|
+
|
|
3
15
|
## 0.6.4
|
|
4
16
|
|
|
5
17
|
### Patch Changes
|
package/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# @tpluscode/eslint-config
|
|
2
2
|
|
|
3
|
-
Slightly customized
|
|
3
|
+
Slightly customized standard-style config for ESLint flat config.
|
|
4
4
|
|
|
5
5
|
## Installation
|
|
6
6
|
|
|
@@ -30,21 +30,30 @@ npm i --save-dev \
|
|
|
30
30
|
|
|
31
31
|
In a JavaScript project:
|
|
32
32
|
|
|
33
|
-
```
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
33
|
+
```js
|
|
34
|
+
import config from '@tpluscode/eslint-config/js'
|
|
35
|
+
|
|
36
|
+
export default [
|
|
37
|
+
...config,
|
|
38
|
+
]
|
|
37
39
|
```
|
|
38
40
|
|
|
39
41
|
In a TypeScript project:
|
|
40
42
|
|
|
41
|
-
```
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
43
|
+
```js
|
|
44
|
+
import config from '@tpluscode/eslint-config'
|
|
45
|
+
|
|
46
|
+
export default [
|
|
47
|
+
...config,
|
|
48
|
+
{
|
|
49
|
+
languageOptions: {
|
|
50
|
+
parserOptions: {
|
|
51
|
+
project: './tsconfig.json',
|
|
52
|
+
tsconfigRootDir: import.meta.dirname,
|
|
53
|
+
},
|
|
54
|
+
},
|
|
55
|
+
},
|
|
56
|
+
]
|
|
48
57
|
```
|
|
49
58
|
|
|
50
59
|
`parserOptions.project` is required for TypeScript projects unless the rule `@typescript-eslint/consistent-type-exports` is disabled.
|
package/eslint.config.js
ADDED
package/index.js
CHANGED
|
@@ -1,61 +1,48 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
multiline: {
|
|
20
|
-
delimiter: 'none'
|
|
21
|
-
}
|
|
22
|
-
}
|
|
23
|
-
],
|
|
24
|
-
'no-dupe-class-members': 'off',
|
|
25
|
-
'@typescript-eslint/no-dupe-class-members': ['error'],
|
|
26
|
-
'no-redeclare': 'off',
|
|
27
|
-
'@typescript-eslint/no-redeclare': 'warn',
|
|
28
|
-
'@typescript-eslint/no-unused-vars': 'off',
|
|
29
|
-
'@typescript-eslint/consistent-type-exports': 'error',
|
|
30
|
-
'@typescript-eslint/consistent-type-imports': 'error'
|
|
31
|
-
},
|
|
32
|
-
settings: {
|
|
33
|
-
'import/parsers': {
|
|
34
|
-
'@typescript-eslint/parser': ['.ts', '.tsx']
|
|
1
|
+
import tsPlugin from '@typescript-eslint/eslint-plugin'
|
|
2
|
+
import tsParser from '@typescript-eslint/parser'
|
|
3
|
+
import importPlugin from 'eslint-plugin-import'
|
|
4
|
+
import jsConfig from './js.js'
|
|
5
|
+
|
|
6
|
+
function rulesFrom(config) {
|
|
7
|
+
return config && config.rules ? config.rules : {}
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
export default [
|
|
11
|
+
...jsConfig,
|
|
12
|
+
{
|
|
13
|
+
files: ['**/*.{ts,mts,cts,tsx}'],
|
|
14
|
+
languageOptions: {
|
|
15
|
+
parser: tsParser,
|
|
16
|
+
parserOptions: {
|
|
17
|
+
sourceType: 'module',
|
|
18
|
+
},
|
|
35
19
|
},
|
|
36
|
-
|
|
37
|
-
typescript:
|
|
38
|
-
alwaysTryTypes: true
|
|
39
|
-
}
|
|
40
|
-
}
|
|
41
|
-
},
|
|
42
|
-
overrides: [
|
|
43
|
-
{
|
|
44
|
-
files: [
|
|
45
|
-
'*.conf.js',
|
|
46
|
-
'*.config.js'
|
|
47
|
-
],
|
|
48
|
-
rules: {
|
|
49
|
-
'@typescript-eslint/no-var-requires': 'off'
|
|
50
|
-
}
|
|
20
|
+
plugins: {
|
|
21
|
+
'@typescript-eslint': tsPlugin,
|
|
51
22
|
},
|
|
52
|
-
{
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
}
|
|
23
|
+
settings: {
|
|
24
|
+
'import/parsers': {
|
|
25
|
+
'@typescript-eslint/parser': ['.ts', '.tsx', '.mts', '.cts'],
|
|
26
|
+
},
|
|
27
|
+
'import/resolver': {
|
|
28
|
+
typescript: {
|
|
29
|
+
alwaysTryTypes: true,
|
|
30
|
+
},
|
|
31
|
+
},
|
|
32
|
+
},
|
|
33
|
+
rules: {
|
|
34
|
+
...rulesFrom(tsPlugin.configs.recommended),
|
|
35
|
+
...rulesFrom(importPlugin.configs.typescript),
|
|
36
|
+
|
|
37
|
+
'no-dupe-class-members': 'off',
|
|
38
|
+
'no-redeclare': 'off',
|
|
39
|
+
'@typescript-eslint/no-redeclare': 'warn',
|
|
40
|
+
'no-unused-vars': 'off',
|
|
41
|
+
'@typescript-eslint/consistent-type-exports': 'error',
|
|
42
|
+
'@typescript-eslint/consistent-type-imports': 'error',
|
|
43
|
+
'no-useless-constructor': 'off',
|
|
44
|
+
'@typescript-eslint/no-useless-constructor': 'error',
|
|
45
|
+
'no-undef': 'off',
|
|
46
|
+
},
|
|
47
|
+
},
|
|
48
|
+
]
|
package/js.js
CHANGED
|
@@ -1,82 +1,125 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
'
|
|
25
|
-
{
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
1
|
+
import { createRequire } from 'module'
|
|
2
|
+
import js from '@eslint/js'
|
|
3
|
+
import globals from 'globals'
|
|
4
|
+
import importPlugin from 'eslint-plugin-import'
|
|
5
|
+
import mocha from 'eslint-plugin-mocha'
|
|
6
|
+
import n from 'eslint-plugin-n'
|
|
7
|
+
import promise from 'eslint-plugin-promise'
|
|
8
|
+
import rdf from 'eslint-plugin-rdf'
|
|
9
|
+
import unusedImports from 'eslint-plugin-unused-imports'
|
|
10
|
+
|
|
11
|
+
const require = createRequire(import.meta.url)
|
|
12
|
+
const requireExtensions = require('eslint-plugin-require-extensions')
|
|
13
|
+
|
|
14
|
+
function rulesFrom(config) {
|
|
15
|
+
return config && config.rules ? config.rules : {}
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
export default [
|
|
19
|
+
js.configs.recommended,
|
|
20
|
+
{
|
|
21
|
+
files: ['**/*.{js,cjs,mjs}'],
|
|
22
|
+
languageOptions: {
|
|
23
|
+
ecmaVersion: 'latest',
|
|
24
|
+
sourceType: 'module',
|
|
25
|
+
globals: {
|
|
26
|
+
...globals.es2022,
|
|
27
|
+
...globals.node,
|
|
28
|
+
},
|
|
29
|
+
},
|
|
30
|
+
plugins: {
|
|
31
|
+
import: importPlugin,
|
|
32
|
+
mocha,
|
|
33
|
+
n,
|
|
34
|
+
promise,
|
|
35
|
+
rdf,
|
|
36
|
+
'require-extensions': requireExtensions,
|
|
37
|
+
'unused-imports': unusedImports,
|
|
38
|
+
},
|
|
39
|
+
settings: {
|
|
40
|
+
'import/resolver': {
|
|
41
|
+
node: true,
|
|
42
|
+
},
|
|
43
|
+
},
|
|
44
|
+
rules: {
|
|
45
|
+
...rulesFrom(importPlugin.configs.recommended),
|
|
46
|
+
...rulesFrom(n.configs['flat/recommended']),
|
|
47
|
+
...rulesFrom(promise.configs['flat/recommended']),
|
|
48
|
+
...rulesFrom(rdf.configs.recommended),
|
|
49
|
+
...rulesFrom(requireExtensions.configs.recommended),
|
|
50
|
+
...rulesFrom(mocha.configs.recommended),
|
|
51
|
+
|
|
52
|
+
indent: ['error', 2],
|
|
53
|
+
'no-console': 'error',
|
|
54
|
+
'import/no-unresolved': 'error',
|
|
55
|
+
'import/extensions': 'off',
|
|
56
|
+
'import/order': 'error',
|
|
57
|
+
'space-before-function-paren': [
|
|
58
|
+
'error',
|
|
59
|
+
{
|
|
60
|
+
named: 'never',
|
|
61
|
+
},
|
|
62
|
+
],
|
|
63
|
+
'comma-dangle': [
|
|
64
|
+
'error',
|
|
65
|
+
'always-multiline',
|
|
66
|
+
],
|
|
67
|
+
'import/no-extraneous-dependencies': [
|
|
68
|
+
'error',
|
|
69
|
+
{
|
|
70
|
+
devDependencies: [
|
|
71
|
+
'**/test/**/*.ts',
|
|
72
|
+
'**/tests/**/*.ts',
|
|
73
|
+
'*.test.ts',
|
|
74
|
+
'*.spec.ts',
|
|
75
|
+
'*.test.js',
|
|
76
|
+
'*.spec.js',
|
|
77
|
+
'**/test/**/*.js',
|
|
78
|
+
'**/tests/**/*.js',
|
|
79
|
+
'*.test.js',
|
|
80
|
+
'*.spec.js',
|
|
81
|
+
'**/test/**/*.mjs',
|
|
82
|
+
'**/tests/**/*.mjs',
|
|
83
|
+
'*.test.mjs',
|
|
84
|
+
'*.spec.mjs',
|
|
85
|
+
],
|
|
86
|
+
optionalDependencies: true,
|
|
87
|
+
},
|
|
88
|
+
],
|
|
89
|
+
'no-unused-vars': 'off',
|
|
90
|
+
'unused-imports/no-unused-imports': 'error',
|
|
91
|
+
'unused-imports/no-unused-vars': [
|
|
92
|
+
'warn',
|
|
93
|
+
{
|
|
94
|
+
vars: 'all',
|
|
95
|
+
varsIgnorePattern: '^_',
|
|
96
|
+
args: 'after-used',
|
|
97
|
+
argsIgnorePattern: '^_',
|
|
98
|
+
},
|
|
99
|
+
],
|
|
100
|
+
'mocha/no-sibling-hooks': 'off',
|
|
101
|
+
'mocha/no-setup-in-describe': 'warn',
|
|
102
|
+
'mocha/max-top-level-suites': 'warn',
|
|
103
|
+
},
|
|
104
|
+
},
|
|
105
|
+
{
|
|
106
|
+
files: [
|
|
107
|
+
'**/*.test.js',
|
|
108
|
+
'**/*.spec.js',
|
|
109
|
+
'**/*.test.mjs',
|
|
110
|
+
'**/*.spec.mjs',
|
|
111
|
+
'**/*.test.ts',
|
|
112
|
+
'**/*.spec.ts',
|
|
60
113
|
],
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
114
|
+
languageOptions: {
|
|
115
|
+
globals: globals.mocha,
|
|
116
|
+
},
|
|
117
|
+
rules: {
|
|
118
|
+
'no-unused-expressions': 'off',
|
|
119
|
+
'func-names': 'off',
|
|
120
|
+
'prefer-arrow-callback': 'off',
|
|
121
|
+
'n/no-unpublished-import': 'off',
|
|
122
|
+
'n/no-unpublished-require': 'off',
|
|
123
|
+
},
|
|
64
124
|
},
|
|
65
|
-
|
|
66
|
-
{
|
|
67
|
-
files: [
|
|
68
|
-
'*.test.js',
|
|
69
|
-
'*.spec.js',
|
|
70
|
-
'*.test.mjs',
|
|
71
|
-
'*.spec.mjs',
|
|
72
|
-
'*.test.ts',
|
|
73
|
-
'*.spec.ts'
|
|
74
|
-
],
|
|
75
|
-
rules: {
|
|
76
|
-
'no-unused-expressions': 'off',
|
|
77
|
-
'func-names': 'off',
|
|
78
|
-
'prefer-arrow-callback': 'off'
|
|
79
|
-
}
|
|
80
|
-
}
|
|
81
|
-
]
|
|
82
|
-
}
|
|
125
|
+
]
|
package/package.json
CHANGED
|
@@ -1,41 +1,48 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tpluscode/eslint-config",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"
|
|
3
|
+
"version": "1.0.1",
|
|
4
|
+
"type": "module",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"scripts": {
|
|
7
7
|
"prepare": "husky",
|
|
8
8
|
"test": "eslint .",
|
|
9
9
|
"release": "changeset publish"
|
|
10
10
|
},
|
|
11
|
+
"engines": {
|
|
12
|
+
"node": ">=18.18"
|
|
13
|
+
},
|
|
14
|
+
"dependencies": {
|
|
15
|
+
"@eslint/js": ">=9 <11",
|
|
16
|
+
"globals": "^15.0.0"
|
|
17
|
+
},
|
|
11
18
|
"peerDependencies": {
|
|
12
|
-
"eslint": "
|
|
13
|
-
"eslint-
|
|
14
|
-
"eslint-plugin-
|
|
15
|
-
"eslint-plugin-
|
|
16
|
-
"eslint-plugin-
|
|
17
|
-
"eslint-plugin-
|
|
18
|
-
"eslint-plugin-
|
|
19
|
-
"eslint-plugin-
|
|
20
|
-
"eslint-plugin-require-extensions": ">=0.1.3",
|
|
21
|
-
"eslint-plugin-unused-imports": "^3.0.0",
|
|
22
|
-
"standard": ">=11"
|
|
19
|
+
"eslint": "^9",
|
|
20
|
+
"eslint-plugin-import": "^2.32.0",
|
|
21
|
+
"eslint-plugin-mocha": "^11.3.0",
|
|
22
|
+
"eslint-plugin-n": "^18.0.1",
|
|
23
|
+
"eslint-plugin-promise": "^7.3.0",
|
|
24
|
+
"eslint-plugin-rdf": "^2.0.1",
|
|
25
|
+
"eslint-plugin-require-extensions": "^0.1.3",
|
|
26
|
+
"eslint-plugin-unused-imports": "^4.0.0"
|
|
23
27
|
},
|
|
24
28
|
"optionalDependencies": {
|
|
25
|
-
"@typescript-eslint/eslint-plugin": "
|
|
26
|
-
"@typescript-eslint/parser": "
|
|
27
|
-
"eslint-import-resolver-typescript": "
|
|
29
|
+
"@typescript-eslint/eslint-plugin": "^8.0.0",
|
|
30
|
+
"@typescript-eslint/parser": "^8.0.0",
|
|
31
|
+
"eslint-import-resolver-typescript": "^3.0.0"
|
|
28
32
|
},
|
|
29
33
|
"devDependencies": {
|
|
30
|
-
"@changesets/cli": "^2.
|
|
31
|
-
"eslint": "^8",
|
|
32
|
-
"eslint
|
|
33
|
-
"eslint
|
|
34
|
-
"eslint-
|
|
35
|
-
"eslint-plugin-
|
|
36
|
-
"eslint-plugin-
|
|
37
|
-
"eslint-plugin-
|
|
38
|
-
"
|
|
34
|
+
"@changesets/cli": "^2.31.0",
|
|
35
|
+
"@typescript-eslint/eslint-plugin": "^8.0.0",
|
|
36
|
+
"@typescript-eslint/parser": "^8.0.0",
|
|
37
|
+
"eslint": "^9",
|
|
38
|
+
"eslint-import-resolver-typescript": "^4.4.4",
|
|
39
|
+
"eslint-plugin-import": "^2.32.0",
|
|
40
|
+
"eslint-plugin-mocha": "^11.3.0",
|
|
41
|
+
"eslint-plugin-n": "^18.0.1",
|
|
42
|
+
"eslint-plugin-promise": "^7.3.0",
|
|
43
|
+
"eslint-plugin-rdf": "^2.0.1",
|
|
44
|
+
"eslint-plugin-require-extensions": "^0.1.3",
|
|
45
|
+
"eslint-plugin-unused-imports": "^4.4.1",
|
|
39
46
|
"lint-staged": "^15.2.7",
|
|
40
47
|
"husky": "^9.0.11"
|
|
41
48
|
},
|
package/.eslintrc.json
DELETED