@tpluscode/eslint-config 0.6.3 → 1.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.
@@ -6,8 +6,8 @@ jobs:
6
6
  lint:
7
7
  runs-on: ubuntu-latest
8
8
  steps:
9
- - uses: actions/checkout@v4
10
- - uses: actions/setup-node@v4
9
+ - uses: actions/checkout@v6
10
+ - uses: actions/setup-node@v6
11
11
  with:
12
12
  node-version: 20
13
13
  - run: npm ci
@@ -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@v4
21
+ uses: actions/checkout@v6
17
22
 
18
- - uses: actions/setup-node@v4
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.0
4
+
5
+ ### Major Changes
6
+
7
+ - 4218648: Updated to eslint v9 flat config
8
+
9
+ ## 0.6.4
10
+
11
+ ### Patch Changes
12
+
13
+ - a073786: Disable `prefer-arrow-callback` in tests (conflicts with mocha rules)
14
+
3
15
  ## 0.6.3
4
16
 
5
17
  ### Patch Changes
package/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # @tpluscode/eslint-config
2
2
 
3
- Slightly customized `standard` config.
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
- ```json
34
- {
35
- "extends": [ "@tpluscode/eslint-config/js" ]
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
- ```json
42
- {
43
- "extends": [ "@tpluscode" ],
44
- "parserOptions": {
45
- "project": "./tsconfig.json"
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.
@@ -0,0 +1,12 @@
1
+ import jsConfig from './js.js'
2
+
3
+ export default [
4
+ ...jsConfig,
5
+ {
6
+ settings: {
7
+ 'import/resolver': {
8
+ typescript: { alwaysTryTypes: true },
9
+ },
10
+ },
11
+ },
12
+ ]
package/index.js CHANGED
@@ -1,61 +1,48 @@
1
- module.exports = {
2
- extends: [
3
- 'plugin:@typescript-eslint/recommended',
4
- './js.js',
5
- 'plugin:import/typescript'
6
- ],
7
- parserOptions: {
8
- parser: '@typescript-eslint/parser'
9
- },
10
- plugins: [
11
- '@typescript-eslint/eslint-plugin'
12
- ],
13
- rules: {
14
- indent: 'off',
15
- '@typescript-eslint/indent': ['error', 2],
16
- '@typescript-eslint/member-delimiter-style': [
17
- 'error',
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
- 'import/resolver': {
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
- files: ['*.ts', '*.mts', '*.cts', '*.tsx'],
54
- rules: {
55
- 'no-useless-constructor': 'off',
56
- '@typescript-eslint/no-useless-constructor': 'error',
57
- 'no-undef': 'off'
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,81 +1,123 @@
1
- module.exports = {
2
- extends: [
3
- 'standard',
4
- 'plugin:import/errors',
5
- 'plugin:import/warnings',
6
- 'plugin:require-extensions/recommended',
7
- 'plugin:rdf/recommended',
8
- 'plugin:mocha/recommended'
9
- ],
10
- plugins: [
11
- 'import',
12
- 'require-extensions',
13
- 'unused-imports',
14
- 'rdf',
15
- 'mocha'
16
- ],
17
- rules: {
18
- indent: ['error', 2],
19
- 'no-console': 'error',
20
- 'import/no-unresolved': 'error',
21
- 'import/extensions': 'off',
22
- 'import/order': 'error',
23
- 'space-before-function-paren': [
24
- 'error',
25
- {
26
- named: 'never'
27
- }
28
- ],
29
- 'comma-dangle': [
30
- 'error',
31
- 'always-multiline'
32
- ],
33
- 'import/no-extraneous-dependencies': [
34
- 'error',
35
- {
36
- devDependencies: [
37
- '**/test/**/*.ts',
38
- '**/tests/**/*.ts',
39
- '*.test.ts',
40
- '*.spec.ts',
41
- '*.test.js',
42
- '*.spec.js',
43
- '**/test/**/*.js',
44
- '**/tests/**/*.js',
45
- '*.test.js',
46
- '*.spec.js',
47
- '**/test/**/*.mjs',
48
- '**/tests/**/*.mjs',
49
- '*.test.mjs',
50
- '*.spec.mjs'
51
- ],
52
- optionalDependencies: false
53
- }
54
- ],
55
- 'no-unused-vars': 'off',
56
- 'unused-imports/no-unused-imports': 'error',
57
- 'unused-imports/no-unused-vars': [
58
- 'warn',
59
- { vars: 'all', varsIgnorePattern: '^_', args: 'after-used', argsIgnorePattern: '^_' }
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
- 'mocha/no-sibling-hooks': 'off',
62
- 'mocha/no-setup-in-describe': 'warn',
63
- 'mocha/max-top-level-suites': 'warn'
114
+ languageOptions: {
115
+ globals: globals.mocha,
116
+ },
117
+ rules: {
118
+ 'no-unused-expressions': 'off',
119
+ 'func-names': 'off',
120
+ 'prefer-arrow-callback': 'off',
121
+ },
64
122
  },
65
- overrides: [
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
- }
79
- }
80
- ]
81
- }
123
+ ]
package/package.json CHANGED
@@ -1,41 +1,48 @@
1
1
  {
2
2
  "name": "@tpluscode/eslint-config",
3
- "version": "0.6.3",
4
- "description": "",
3
+ "version": "1.0.0",
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": ">=6",
13
- "eslint-config-standard": ">=11",
14
- "eslint-plugin-import": ">=2",
15
- "eslint-plugin-mocha": "^10.5.0",
16
- "eslint-plugin-n": ">=15",
17
- "eslint-plugin-node": ">=11",
18
- "eslint-plugin-promise": ">=6",
19
- "eslint-plugin-rdf": ">=1",
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": ">=2",
26
- "@typescript-eslint/parser": ">=2",
27
- "eslint-import-resolver-typescript": ">=2"
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.26.0",
31
- "eslint": "^8",
32
- "eslint-config-standard": "^17.1.0",
33
- "eslint-plugin-import": "^2.29.1",
34
- "eslint-plugin-node": "^11.1.0",
35
- "eslint-plugin-promise": "^6.2.0",
36
- "eslint-plugin-rdf": "^1.0",
37
- "eslint-plugin-unused-imports": "^3.0.0",
38
- "standard": "^17.1.0",
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
@@ -1,3 +0,0 @@
1
- {
2
- "extends": "standard"
3
- }