eslint-config-fabulator 4.3.0 → 5.1.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/CHANGELOG.md CHANGED
@@ -1,6 +1,20 @@
1
1
  # Change Log
2
2
  All notable changes to this project will be documented in this file.
3
3
 
4
+ ## v5.1.0 (2025-03-20)
5
+ ### Added
6
+ - [ed6ada0](https://github.com/fabulator/eslint-config-fabulator/commit/ed6ada0cc4173e54ff2413f341bf48beb3fe24c2) Vitest rules
7
+
8
+ ## v5.0.0 (2025-03-20)
9
+ ### Changed
10
+ - [09dd656](https://github.com/fabulator/eslint-config-fabulator/commit/09dd656e7c1e57ee4c9f019bd898774f183dab05) Upgrade to eslint 9 BREAKING
11
+ - [74201a1](https://github.com/fabulator/eslint-config-fabulator/commit/74201a156a9826e2cb1c39bcb2b79ece3ce2ed93) Update Github Flow dependency node to v20.19.0 (#186)
12
+
13
+ Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
14
+ - [6d90841](https://github.com/fabulator/eslint-config-fabulator/commit/6d9084148b1d22bf01339fee772c04b75bef1057) Update Github Flow dependency node to v20.18.3 (#184)
15
+
16
+ Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
17
+
4
18
  ## v4.3.0 (2024-10-24)
5
19
  ### Changed
6
20
  - [8b8aef0](https://github.com/fabulator/eslint-config-fabulator/commit/8b8aef01f3329c335951a1f1ec5ea49496bc9282) Remove sonarjs - too louzy
package/README.md CHANGED
@@ -1,48 +1,3 @@
1
1
  # ESLint Config Fabulator
2
2
 
3
- This is default ESlint configurations for projects for Fabulator.
4
-
5
- ## Usage
6
-
7
- First install the package:
8
-
9
- ```nodemon
10
- npm install eslint-config-fabulator --save-dev
11
- ```
12
-
13
- and update you ESLint configuration:
14
-
15
- ```javascript
16
- module.exports = {
17
- extends: [
18
- 'eslint-config-fabulator',
19
- ],
20
- };
21
-
22
- ```
23
-
24
- In basic configuration following plugins are included:
25
-
26
- - **import** - We use ECMAScript 6 modules.
27
- - **jsdoc** - Predefined style for comments of methods.
28
- - **promise** - Predefined style for promises.
29
- - **compat** - To check that used features are supported by certain browsers.
30
- - **unicorn** - Various lints.
31
- - **filenames** - Lint file names.
32
- - **sonar** - various piggy code detection
33
- - **typescript**
34
- - **array-func**
35
-
36
- There are more extendable configurations for tests or different envs:
37
-
38
- ```javascript
39
- module.exports = {
40
- extends: [
41
- 'eslint-config-fabulator',
42
- 'eslint-config-fabulator/eslint-config/react',
43
- 'eslint-config-fabulator/eslint-config/jasmine',
44
- 'eslint-config-fabulator/eslint-config/jest',
45
- 'eslint-config-fabulator/eslint-config/babel-resolver',
46
- ],
47
- };
48
- ```
3
+ This is default ESlint configurations for projects for Fabulator ;)
package/index.js CHANGED
@@ -1,82 +1,155 @@
1
- // eslint-disable-next-line canonical/filename-no-index
2
- const jestConfig = require('./jest');
3
- const reactConfig = require('./react');
1
+ import { defineConfig } from 'eslint/config';
2
+ import reactPlugin from 'eslint-plugin-react';
3
+ import eslintPluginPrettierRecommended from 'eslint-plugin-prettier/recommended';
4
+ import arrayFunc from 'eslint-plugin-array-func';
5
+ import js from '@eslint/js';
6
+ import canonical from 'eslint-plugin-canonical';
7
+ import importPlugin from 'eslint-plugin-import';
8
+ import tseslint from 'typescript-eslint';
9
+ import reactHooks from 'eslint-plugin-react-hooks';
10
+ import globals from 'globals';
11
+ import jsxA11y from 'eslint-plugin-jsx-a11y';
12
+ import vitest from '@vitest/eslint-plugin';
4
13
 
5
- module.exports = {
6
- extends: [
7
- 'eslint:recommended',
8
- 'plugin:canonical/recommended',
9
- 'plugin:import/recommended',
10
- 'plugin:array-func/recommended',
11
- 'plugin:prettier/recommended',
12
- ],
13
- overrides: [
14
- {
15
- files: ['*.test.*'],
16
- ...jestConfig,
14
+ // eslint-disable-next-line import/no-default-export
15
+ export default defineConfig([
16
+ {
17
+ extends: [arrayFunc.configs.recommended],
18
+ rules: { 'array-func/prefer-array-from': 0 },
19
+ },
20
+ {
21
+ extends: [js.configs.recommended],
22
+ rules: { 'no-irregular-whitespace': 'off' },
23
+ },
24
+ {
25
+ files: ['**/*.test.ts', '**/*.test.js', '**/*.test.jsx', '**/*.test.tsx'],
26
+ plugins: {
27
+ vitest,
28
+ },
29
+ rules: {
30
+ ...vitest.configs.recommended.rules,
31
+ },
32
+ },
33
+ {
34
+ extends: [importPlugin.flatConfigs.recommended],
35
+ rules: {
36
+ 'import/no-deprecated': 'error',
37
+ 'import/no-empty-named-blocks': 'error',
38
+ 'import/no-extraneous-dependencies': [
39
+ 'error',
40
+ {
41
+ devDependencies: [
42
+ '**/*.config.js',
43
+ '**/*.config.ts',
44
+ '**/*.setup.ts',
45
+ '**/*.test.ts',
46
+ '**/*.test.tsx',
47
+ '**/lang/**/*.*',
48
+ ],
49
+ },
50
+ ],
51
+ 'import/no-mutable-exports': 'error',
52
+ 'import/no-unused-modules': 'error',
53
+ 'import/no-cycle': 'error',
54
+ 'import/no-relative-packages': 'error',
55
+ 'import/no-self-import': 'error',
56
+ 'import/order': ['error', { 'newlines-between': 'never' }],
57
+ 'import/no-default-export': 'error',
58
+ 'import/newline-after-import': 'error',
59
+ 'import/first': 'error',
60
+ },
61
+ },
62
+ {
63
+ files: ['**/*.config.*s'],
64
+ rules: {
65
+ 'import/no-default-export': 'off',
66
+ },
67
+ },
68
+ {
69
+ plugins: {
70
+ canonical: canonical,
71
+ },
72
+ },
73
+ {
74
+ extends: [reactHooks.configs['recommended-latest']],
75
+ files: ['**/use*.*sx', '**/use*.js', '**/use*.ts', '**/*.tsx', '**/*.jsx'],
76
+ rules: {
77
+ 'react-hooks/exhaustive-deps': 'error',
78
+ 'react-hooks/rules-of-hooks': 'error',
17
79
  },
18
- {
19
- files: ['*.*sx'],
20
- ...reactConfig,
80
+ },
81
+ {
82
+ extends: [
83
+ reactPlugin.configs.flat.recommended,
84
+ jsxA11y.flatConfigs.recommended,
85
+ ],
86
+ files: ['**/*.tsx', '**/*.jsx'],
87
+ rules: {
88
+ 'react/react-in-jsx-scope': 'off',
89
+ 'react/display-name': 'off',
21
90
  },
22
- {
23
- extends: ['plugin:react-hooks/recommended'],
24
- files: ['use*.*sx', 'use*.js', 'use*.ts'],
25
- rules: {
26
- 'react-hooks/exhaustive-deps': 'error',
27
- 'react-hooks/rules-of-hooks': 'error',
91
+ settings: {
92
+ react: {
93
+ version: 'detect',
28
94
  },
29
95
  },
30
- {
31
- extends: [
32
- 'plugin:@typescript-eslint/strict-type-checked',
33
- 'plugin:typescript-sort-keys/recommended',
34
- 'plugin:import/typescript',
35
- 'plugin:prettier/recommended',
96
+ },
97
+ {
98
+ extends: [
99
+ tseslint.configs.strictTypeChecked,
100
+ tseslint.configs.stylisticTypeChecked,
101
+ ],
102
+ files: ['**/*.tsx', '**/*.ts'],
103
+ rules: {
104
+ '@typescript-eslint/consistent-type-definitions': 'off',
105
+ '@typescript-eslint/restrict-template-expressions': [
106
+ 'error',
107
+ {
108
+ allowAny: false,
109
+ allowBoolean: false,
110
+ allowNullish: false,
111
+ allowNumber: true,
112
+ allowRegExp: false,
113
+ allowNever: false,
114
+ },
36
115
  ],
37
- files: ['*.tsx', '*.ts'],
38
- parser: '@typescript-eslint/parser',
39
- rules: {
40
- '@typescript-eslint/no-non-null-asserted-optional-chain': 'off',
41
- '@typescript-eslint/no-non-null-assertion': 'off',
42
- '@typescript-eslint/no-unused-vars': [
43
- 'error',
44
- {
45
- args: 'all',
46
- argsIgnorePattern: '^_',
47
- ignoreRestSiblings: true,
48
- vars: 'all',
49
- },
50
- ],
51
- '@typescript-eslint/non-nullable-type-assertion-style': 'error',
52
- '@typescript-eslint/prefer-optional-chain': 'error',
53
- },
116
+ '@typescript-eslint/no-non-null-asserted-optional-chain': 'off',
117
+ '@typescript-eslint/no-non-null-assertion': 'off',
118
+ '@typescript-eslint/no-empty-function': 'off',
119
+ '@typescript-eslint/no-unused-vars': 'off',
120
+ '@typescript-eslint/no-empty-object-type': 'off',
121
+ '@typescript-eslint/non-nullable-type-assertion-style': 'error',
122
+ '@typescript-eslint/prefer-optional-chain': 'error',
123
+ '@typescript-eslint/prefer-nullish-coalescing': 0,
124
+ },
125
+ },
126
+ {
127
+ languageOptions: {
128
+ globals: { ...globals.browser, ...globals.node },
129
+ parserOptions: { ecmaVersion: 'latest' },
130
+ },
131
+ linterOptions: {
132
+ reportUnusedInlineConfigs: 'error',
133
+ reportUnusedDisableDirectives: 'error',
54
134
  },
55
- {
56
- files: ['*.json'],
57
- plugins: ['json-format'],
58
- rules: {
59
- 'json/sort-package-json': [2, 'standard'],
135
+ settings: {
136
+ 'import/resolver': {
137
+ // You will also need to install and configure the TypeScript resolver
138
+ // See also https://github.com/import-js/eslint-import-resolver-typescript#configuration
139
+ typescript: true,
140
+ node: true,
60
141
  },
61
142
  },
62
- ],
63
- parserOptions: {
64
- ecmaVersion: 'latest',
65
143
  },
66
- plugins: ['filenames'],
67
- reportUnusedDisableDirectives: true,
68
- rules: {
69
- 'canonical/destructuring-property-newline': 0,
70
- 'canonical/export-specifier-newline': 0,
71
- 'canonical/filename-no-index': 'error',
72
- 'canonical/import-specifier-newline': 0,
73
- 'filenames/match-exported': [2, null, '\\.config.js$'],
74
- 'no-irregular-whitespace': 0,
75
- 'prettier/prettier': [
76
- 'error',
77
- {
78
- singleQuote: true,
79
- },
80
- ],
144
+ eslintPluginPrettierRecommended,
145
+ {
146
+ rules: {
147
+ 'prettier/prettier': [
148
+ 'error',
149
+ {
150
+ singleQuote: true,
151
+ },
152
+ ],
153
+ },
81
154
  },
82
- };
155
+ ]);
package/package.json CHANGED
@@ -1,7 +1,8 @@
1
1
  {
2
2
  "name": "eslint-config-fabulator",
3
- "version": "4.3.0",
3
+ "version": "5.1.0",
4
4
  "description": "Shared ESLint config for fabulator projects",
5
+ "type": "module",
5
6
  "keywords": [
6
7
  "eslint",
7
8
  "eslint-config",
@@ -19,36 +20,30 @@
19
20
  "author": "Michal Ozogán <michal@ozogan.eu>",
20
21
  "main": "index.js",
21
22
  "scripts": {
22
- "lint": "eslint ./ --ext .js --ext .json --config index.js --env node",
23
+ "lint": "eslint ./ --ext .js --config index.js",
23
24
  "lint:fix": "npm run lint -- --fix",
24
- "release": "semantic-release",
25
- "test": "node node_modules/jest/bin/jest.js",
26
- "test-and-lint": "npm run test && npm run lint"
25
+ "release": "semantic-release"
27
26
  },
28
27
  "dependencies": {
29
- "@typescript-eslint/eslint-plugin": "^7.18.0",
30
- "@typescript-eslint/parser": "^7.18.0",
31
- "eslint": "^8.57.0",
32
- "eslint-config-prettier": "^9.1.0",
33
- "eslint-plugin-array-func": "4.0.0",
34
- "eslint-plugin-canonical": "^5.0.0",
35
- "eslint-plugin-filenames": "^1.3.2",
36
- "eslint-plugin-import": "^2.30.0",
37
- "eslint-plugin-jest": "^28.8.3",
38
- "eslint-plugin-json-format": "^2.0.1",
39
- "eslint-plugin-jsx-a11y": "^6.10.0",
40
- "eslint-plugin-prettier": "^5.2.1",
41
- "eslint-plugin-react": "^7.35.2",
42
- "eslint-plugin-react-hooks": "^4.6.2",
43
- "eslint-plugin-typescript-sort-keys": "^3.2.0",
44
- "prettier": "^3.3.3"
28
+ "@eslint/js": "^9.22.0",
29
+ "@vitest/eslint-plugin": "^1.1.38",
30
+ "eslint": "^9.22.0",
31
+ "eslint-config-prettier": "^10.1.1",
32
+ "eslint-plugin-array-func": "5.0.2",
33
+ "eslint-plugin-canonical": "^5.1.3",
34
+ "eslint-plugin-import": "^2.31.0",
35
+ "eslint-plugin-jsx-a11y": "^6.10.2",
36
+ "eslint-plugin-prettier": "^5.2.3",
37
+ "eslint-plugin-react": "^7.37.4",
38
+ "eslint-plugin-react-hooks": "^5.2.0",
39
+ "globals": "^16.0.0",
40
+ "prettier": "^3.5.3",
41
+ "typescript-eslint": "^8.27.0"
45
42
  },
46
43
  "devDependencies": {
47
44
  "commitlint-config-fabulator": "^6.1.0",
48
- "enhanced-resolve": "^5.17.1",
49
- "jest": "^29.7.0",
50
45
  "semantic-release-config-fabulator": "^7.0.0",
51
- "typescript": "^5.5.4"
46
+ "typescript": "^5.8.2"
52
47
  },
53
48
  "peerDependencies": {
54
49
  "typescript": "^5"
package/jest.js DELETED
@@ -1,16 +0,0 @@
1
- module.exports = {
2
- env: {
3
- jest: true,
4
- },
5
- extends: ['plugin:jest/recommended'],
6
- plugins: ['jest'],
7
- rules: {
8
- 'compat/compat': 0,
9
- // no need for testing env
10
- 'promise/catch-or-return': 0,
11
-
12
- // do not check for browser support
13
- 'promise/no-callback-in-promise': 0,
14
- 'sonarjs/no-duplicate-string': 0, // no need for testing env
15
- },
16
- };
package/react.js DELETED
@@ -1,50 +0,0 @@
1
- module.exports = {
2
- extends: [
3
- 'plugin:react/recommended',
4
- 'plugin:prettier/recommended',
5
- 'plugin:jsx-a11y/recommended',
6
- 'plugin:react-hooks/recommended',
7
- ],
8
- rules: {
9
- 'jsx-a11y/label-has-associated-control': [2, { assert: 'htmlFor' }],
10
- 'react/button-has-type': 'error',
11
- 'react/display-name': 0,
12
- 'react/function-component-definition': 'off',
13
- 'react/jsx-filename-extension': [
14
- 'error',
15
- { extensions: ['.js', '.jsx', '.ts', '.tsx'] },
16
- ],
17
- 'react/jsx-max-props-per-line': [
18
- 'error',
19
- { maximum: 1, when: 'multiline' },
20
- ],
21
- 'react/jsx-no-constructed-context-values': 0,
22
- 'react/jsx-no-useless-fragment': 'off',
23
- 'react/jsx-one-expression-per-line': 'off',
24
- 'react/jsx-props-no-spreading': 0,
25
- 'react/jsx-sort-props': [
26
- 2,
27
- {
28
- callbacksLast: true,
29
- shorthandFirst: true,
30
- },
31
- ],
32
- 'react/no-array-index-key': 'error',
33
- 'react/no-danger': 'error',
34
- 'react/no-typos': 'error',
35
- 'react/no-unstable-nested-components': ['error', { allowAsProps: true }],
36
- 'react/no-unused-class-component-methods': 'error',
37
- 'react/no-unused-prop-types': 0,
38
- 'react/prefer-stateless-function': 'error',
39
- 'react/prop-types': 'off',
40
- 'react/react-in-jsx-scope': 0,
41
- 'react/require-default-props': 0,
42
- 'react/state-in-constructor': 'error',
43
- 'prettier/prettier': [
44
- 'error',
45
- {
46
- singleQuote: true,
47
- },
48
- ],
49
- },
50
- };