@madgex/eslint-config-madgex 2.2.0 → 2.4.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 +12 -0
- package/README.md +33 -8
- package/index.js +8 -1
- package/package.json +10 -10
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,18 @@
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
5
|
|
|
6
|
+
# [2.4.0](https://github.com/wiley/madgex-eslint-config-madgex/compare/@madgex/eslint-config-madgex@2.0.0...@madgex/eslint-config-madgex@2.4.0) (2026-02-12)
|
|
7
|
+
|
|
8
|
+
### Bug Fixes
|
|
9
|
+
|
|
10
|
+
- add some default ignores ([c5d58a7](https://github.com/wiley/madgex-eslint-config-madgex/commit/c5d58a79e9cb3a874a658556cd6690b3d5c86489))
|
|
11
|
+
- package dependancies lock major ([3a78107](https://github.com/wiley/madgex-eslint-config-madgex/commit/3a78107b7628713a4a1efac55e2f57a602e4445a))
|
|
12
|
+
|
|
13
|
+
### Features
|
|
14
|
+
|
|
15
|
+
- add no-unused-vars & no-param-reassign allowances ([19a8f33](https://github.com/wiley/madgex-eslint-config-madgex/commit/19a8f334c7039bd9990545631a7450469758ddc4))
|
|
16
|
+
- enforce extra eslint rules ([d00f939](https://github.com/wiley/madgex-eslint-config-madgex/commit/d00f939939891b118c18c8dfaf8d46f5844bb8c3))
|
|
17
|
+
|
|
6
18
|
# [2.0.0](https://github.com/wiley/madgex-eslint-config-madgex/compare/@madgex/eslint-config-madgex@1.4.1...@madgex/eslint-config-madgex@2.0.0) (2024-04-18)
|
|
7
19
|
|
|
8
20
|
-fix!: eslint 9, using modern eslint-plugin-n setup
|
package/README.md
CHANGED
|
@@ -10,28 +10,36 @@ npm install eslint@9 @madgex/eslint-config-madgex -save-dev
|
|
|
10
10
|
|
|
11
11
|
## VSCode extension
|
|
12
12
|
|
|
13
|
-
Use VSCode Extension v3.0.5+ (you might need to switch to pre-release version)
|
|
13
|
+
Use the official VSCode [ESLint Extension](https://marketplace.visualstudio.com/items?itemName=dbaeumer.vscode-eslint) v3.0.5+ (you might need to switch to pre-release version)
|
|
14
14
|
|
|
15
15
|
## Usage
|
|
16
16
|
|
|
17
17
|
> ⚠️ Recomended to use only 1 type of source file in your repo, either `commonjs` or `module` (esm). `eslint` & `eslint-plugin-n` (this config depends on) has difficulty supporting both at the same time in a monorepo.
|
|
18
18
|
|
|
19
|
-
|
|
19
|
+
`eslint-plugin-n` which is a part of our config, reads the package.json for node version, and what `type` of JS files you use (ESM or commonjs).
|
|
20
|
+
|
|
21
|
+
```json5
|
|
20
22
|
// package.json
|
|
21
|
-
// ESM import/export modules, set to commonjs if you are using `require/module.exports`, you cant use both
|
|
22
|
-
"type": "module",
|
|
23
23
|
{
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
24
|
+
...
|
|
25
|
+
"type": "module", // "module" (ESM), or "commonjs" - you cant use both
|
|
26
|
+
{
|
|
27
|
+
"engines": {
|
|
28
|
+
"node": ">=18"
|
|
29
|
+
}
|
|
30
|
+
},
|
|
31
|
+
...
|
|
27
32
|
}
|
|
28
33
|
```
|
|
29
34
|
|
|
35
|
+
`eslint-plugin-n` also recognises `.npmignore` files which will silence warnings of missing dependancies when they are installed as `devDependancies`.
|
|
36
|
+
|
|
30
37
|
### Node/Browser
|
|
31
38
|
|
|
32
39
|
```js
|
|
33
40
|
// eslint.config.js
|
|
34
41
|
import configMadgex from '@madgex/eslint-config-madgex';
|
|
42
|
+
|
|
35
43
|
export default [...configMadgex];
|
|
36
44
|
```
|
|
37
45
|
|
|
@@ -43,6 +51,23 @@ config order matters.
|
|
|
43
51
|
// eslint.config.js
|
|
44
52
|
import configMadgex from '@madgex/eslint-config-madgex';
|
|
45
53
|
import pluginVue from 'eslint-plugin-vue';
|
|
54
|
+
// pluginVue.configs['flat/recommended'] has prettier conflicts
|
|
46
55
|
|
|
47
|
-
export default [...configMadgex, ...pluginVue.configs['flat/
|
|
56
|
+
export default [...configMadgex, ...pluginVue.configs['flat/essential']];
|
|
48
57
|
```
|
|
58
|
+
|
|
59
|
+
### Rules
|
|
60
|
+
|
|
61
|
+
Notes regarding specific rules enforced in this config:
|
|
62
|
+
|
|
63
|
+
- [`no-param-reassign`](https://eslint.org/docs/latest/rules/no-param-reassign) - Disallow reassigning function parameters, except for **`accu`** which is the accumulator in a `.reduce()` e.g.
|
|
64
|
+
|
|
65
|
+
```js
|
|
66
|
+
Array.reduce((accu, key) => {
|
|
67
|
+
accu[key] = getVal(key);
|
|
68
|
+
|
|
69
|
+
return accu;
|
|
70
|
+
}, {});
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
- [`no-unused-vars`](https://eslint.org/docs/latest/rules/no-unused-vars) - Disallow unused variables, except for `request` and `h` as found on hapi.js route handlers.
|
package/index.js
CHANGED
|
@@ -37,7 +37,6 @@ module.exports = [
|
|
|
37
37
|
// https://eslint.org/docs/latest/rules/
|
|
38
38
|
'no-debugger': process.env.NODE_ENV === 'production' ? 2 : 0,
|
|
39
39
|
'no-console': process.env.NODE_ENV === 'production' ? 2 : 0,
|
|
40
|
-
'no-param-reassign': ['error', { props: true }],
|
|
41
40
|
eqeqeq: ['error', 'always', { null: 'ignore' }],
|
|
42
41
|
'no-shadow': 'error',
|
|
43
42
|
'no-lonely-if': 'error',
|
|
@@ -46,6 +45,14 @@ module.exports = [
|
|
|
46
45
|
'default-case': 'error',
|
|
47
46
|
'consistent-return': 'error',
|
|
48
47
|
'func-names': 'warn',
|
|
48
|
+
'no-param-reassign': [
|
|
49
|
+
'error',
|
|
50
|
+
{
|
|
51
|
+
props: true,
|
|
52
|
+
ignorePropertyModificationsFor: ['accu'],
|
|
53
|
+
},
|
|
54
|
+
],
|
|
55
|
+
'no-unused-vars': ['error', { argsIgnorePattern: 'request|h' }],
|
|
49
56
|
},
|
|
50
57
|
},
|
|
51
58
|
];
|
package/package.json
CHANGED
|
@@ -1,27 +1,27 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@madgex/eslint-config-madgex",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.4.0",
|
|
4
4
|
"type": "commonjs",
|
|
5
5
|
"description": "Madgex ESLint config - based on eslint-config-airbnb",
|
|
6
6
|
"main": "index.js",
|
|
7
7
|
"scripts": {
|
|
8
8
|
"build": "echo 'build is not required' || exit 0",
|
|
9
|
-
"lint": "eslint --config index.js *.js"
|
|
10
|
-
"test": "echo \"Error: no test specified\" && exit 1"
|
|
9
|
+
"lint": "eslint --config index.js *.js"
|
|
11
10
|
},
|
|
12
11
|
"keywords": [],
|
|
13
12
|
"author": "James Wragg <james.wragg@madgex.com> (https://madgex.com/)",
|
|
14
13
|
"license": "MIT",
|
|
15
14
|
"peerDependencies": {
|
|
16
|
-
"@eslint/js": "
|
|
17
|
-
"eslint": "
|
|
15
|
+
"@eslint/js": "^9.39.2",
|
|
16
|
+
"eslint": "^9.39.2",
|
|
18
17
|
"eslint-config-prettier": "^9.1.0",
|
|
19
|
-
"eslint-plugin-n": "^17.2
|
|
20
|
-
"eslint-plugin-prettier": "^5.
|
|
21
|
-
"globals": "
|
|
22
|
-
"prettier": "
|
|
18
|
+
"eslint-plugin-n": "^17.23.2",
|
|
19
|
+
"eslint-plugin-prettier": "^5.5.5",
|
|
20
|
+
"globals": "^15",
|
|
21
|
+
"prettier": "^3.8.1"
|
|
23
22
|
},
|
|
24
23
|
"engines": {
|
|
25
24
|
"node": ">=18"
|
|
26
|
-
}
|
|
25
|
+
},
|
|
26
|
+
"gitHead": "0a2d2c26e7303483af175a958488648de0cd3696"
|
|
27
27
|
}
|