@sektek/eslint-plugin 1.1.0 → 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 ADDED
@@ -0,0 +1,3 @@
1
+ import prettierConfig from '@sektek/prettier-config';
2
+
3
+ export default prettierConfig;
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 `.eslintrc.js`:
11
+ Extend the configs you want in your `eslint.config.js` file:
12
12
 
13
13
  ```js
14
- module.exports = {
15
- extends: [
16
- 'plugin:@sektek/typescript',
17
- ],
18
- };
19
- ```
14
+ import { defineConfig } from 'eslint/config';
15
+ import sektek from '@sektek/eslint-plugin';
20
16
 
21
- For TypeScript projects, you should also have a `tsconfig.json` file.
17
+ export default defineConfig([
18
+ sektek.configs.recommended,
19
+ ]);
20
+ ```
22
21
 
23
22
  ## Rules
24
23
 
@@ -1,63 +1,81 @@
1
- module.exports = {
2
- env: {
3
- es2020: true,
4
- node: true,
5
- },
6
- ignorePatterns: ['**/node_modules/*', '**/dist/*'],
7
- extends: [
8
- 'eslint:recommended',
9
- 'plugin:prettier/recommended',
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',
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,
21
36
  },
37
+ ecmaVersion: 'latest',
38
+ sourceType: 'module',
22
39
  },
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',
40
+ settings: {
41
+ 'import/resolver': {
42
+ typescript: true,
29
43
  },
30
44
  },
31
- ],
32
- plugins: [
33
- 'eslint-comments',
34
- 'filenames',
35
- 'import',
36
- 'mocha',
37
- 'prettier',
38
- 'promise',
39
- 'sonarjs',
40
- ],
41
- rules: {
42
- 'filenames/match-regex': ['error', '^[a-z0-9-]+$'],
43
- 'import/newline-after-import': 'error',
44
- 'mocha/no-exclusive-tests': 'error',
45
- 'no-console': 'error',
46
- 'no-eval': 'error',
47
- 'no-duplicate-imports': 'error',
48
- 'no-var': 'error',
49
- 'prefer-const': 'error',
50
- 'prefer-template': 'error',
51
- 'promise/prefer-await-to-callbacks': 'error',
52
- 'promise/prefer-await-to-then': 'error',
53
- 'sort-imports': ['error', { allowSeparatedGroups: true }],
54
- yoda: 'error',
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
+ },
55
64
  },
56
- settings: {
57
- 'import/resolver': {
58
- node: {
59
- extensions: ['.js', '.ts'],
60
- },
65
+ {
66
+ files: ['eslint.config.js', '.*.js'],
67
+ rules: {
68
+ 'check-file/filename-naming-convention': 'off',
69
+ },
70
+ },
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',
61
79
  },
62
80
  },
63
- };
81
+ ];
@@ -1,37 +1,48 @@
1
- module.exports = {
2
- extends: ['plugin:@typescript-eslint/recommended', './configs/recommended'],
3
- parser: '@typescript-eslint/parser',
4
- parserOptions: {
5
- sourceType: 'module',
6
- },
7
- plugins: ['@typescript-eslint'],
8
- overrides: [
9
- {
10
- files: ['globals.d.ts'],
11
- rules: {
12
- 'filenames/match-regex': 'off',
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
+ },
13
16
  },
14
17
  },
15
- {
16
- files: ['*.spec.ts'],
17
- rules: {
18
- '@typescript-eslint/no-unused-expressions': 'off',
19
- },
18
+ },
19
+ {
20
+ files: ['**/*.cjs'],
21
+ rules: {
22
+ '@typescript-eslint/no-require-imports': 'off',
20
23
  },
21
- ],
22
- settings: {
23
- 'import/resolver': {
24
- typescript: {
25
- alwaysTryTypes: true,
26
- },
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',
27
39
  },
28
40
  },
29
- rules: {
30
- 'no-unused-vars': 'off',
31
- '@typescript-eslint/no-unused-vars': 'error',
32
- '@typescript-eslint/no-empty-object-type': [
33
- 'error',
34
- { allowInterfaces: 'always' },
35
- ],
41
+ {
42
+ files: ['**/*.spec.ts'],
43
+ rules: {
44
+ '@typescript-eslint/no-unused-expressions': 'off',
45
+ 'jsdoc/require-jsdoc': 'off',
46
+ },
36
47
  },
37
- };
48
+ ];
@@ -0,0 +1,5 @@
1
+ import { defineConfig } from 'eslint/config';
2
+
3
+ import sektek from './index.js';
4
+
5
+ export default defineConfig([sektek.configs.recommended]);
package/index.js CHANGED
@@ -1,6 +1,9 @@
1
- module.exports = {
1
+ import recommended from './configs/recommended.js';
2
+ import typescript from './configs/typescript.js';
3
+
4
+ export default {
2
5
  configs: {
3
- recommended: require('./configs/recommended'),
4
- typescript: require('./configs/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": "1.1.0",
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,28 +9,38 @@
9
9
  },
10
10
  "license": "MIT",
11
11
  "private": false,
12
- "type": "commonjs",
12
+ "type": "module",
13
13
  "main": "index.js",
14
- "scripts": {},
14
+ "scripts": {
15
+ "lint": "eslint ."
16
+ },
15
17
  "dependencies": {
16
- "@sektek/prettier-config": "^1.1.3",
17
- "@typescript-eslint/eslint-plugin": "^8.33.1",
18
- "@typescript-eslint/parser": "^8.33.1",
19
- "eslint-config-prettier": "^9.1.0",
20
- "eslint-import-resolver-typescript": "^3.6.1",
21
- "eslint-plugin-eslint-comments": "^3.2.0",
22
- "eslint-plugin-filenames": "^1.3.2",
23
- "eslint-plugin-import": "^2.29.1",
24
- "eslint-plugin-mocha": "^10.2.0",
25
- "eslint-plugin-prettier": "^5.0.1",
26
- "eslint-plugin-promise": "^6.1.1",
27
- "eslint-plugin-sonarjs": "^0.23.0"
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
37
  "c8": "^10.1.3",
32
- "eslint": "^8.56.0",
33
- "prettier": "^3.1.1"
38
+ "semantic-release": "^25.0.2"
39
+ },
40
+ "peerDependencies": {
41
+ "@eslint/js": ">=9.39.1",
42
+ "eslint": ">=9.39.1",
43
+ "prettier": ">=3"
34
44
  },
35
45
  "prettier": "@sektek/prettier-config"
36
46
  }