@defra/lis-infra-eslint-config 0.13.0 → 0.14.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/README.md +3 -2
- package/package.json +3 -2
- package/src/index.js +2 -0
- package/src/unicorn.js +17 -0
package/README.md
CHANGED
|
@@ -5,7 +5,7 @@ Shared ESLint flat config for JavaScript/Node.js repos in the LIS ecosystem.
|
|
|
5
5
|
Using Defra's preferred `neostandard` as a base, this config adds `sonarjs` rules based on those enforced by the Defra JavaScript Standard from SonarQube.
|
|
6
6
|
It also adds requirements for `jsdoc`, focussed on exported interfaces, to improve maintainability as well as to provide better experience for developers using IDEs and AI coding agents.
|
|
7
7
|
|
|
8
|
-
**Stack:** ESM · ESLint flat config (neostandard + sonarjs + jsdoc)
|
|
8
|
+
**Stack:** ESM · ESLint flat config (neostandard + sonarjs + jsdoc + unicorn)
|
|
9
9
|
|
|
10
10
|
---
|
|
11
11
|
|
|
@@ -45,7 +45,8 @@ npm run lint # eslint (lints this repo's own source using its own config)
|
|
|
45
45
|
src/
|
|
46
46
|
├── index.js # the exported ESLint flat config array
|
|
47
47
|
├── sonarjs.js # sonarjs-derived rules, sourced from the Defra JS Sonar profile
|
|
48
|
-
|
|
48
|
+
├── jsdoc.js # jsdoc rules, requiring docs on exported functions/methods
|
|
49
|
+
└── unicorn.js # unicorn rules that the Sonar profile has and sonarjs does not
|
|
49
50
|
```
|
|
50
51
|
|
|
51
52
|
---
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@defra/lis-infra-eslint-config",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.14.0",
|
|
4
4
|
"description": "Shared ESLint flat config for the LIS ecosystem",
|
|
5
5
|
"main": "src/index.js",
|
|
6
6
|
"repository": {
|
|
@@ -33,10 +33,11 @@
|
|
|
33
33
|
"dependencies": {
|
|
34
34
|
"eslint-plugin-jsdoc": "^65.4.5",
|
|
35
35
|
"eslint-plugin-sonarjs": "^4.2.2",
|
|
36
|
+
"eslint-plugin-unicorn": "^65.0.1",
|
|
36
37
|
"neostandard": "0.14.1"
|
|
37
38
|
},
|
|
38
39
|
"peerDependencies": {
|
|
39
|
-
"eslint": "^9.
|
|
40
|
+
"eslint": "^9.38.0 || ^10.0.0"
|
|
40
41
|
},
|
|
41
42
|
"devDependencies": {
|
|
42
43
|
"@vitest/coverage-istanbul": "^5.1.0",
|
package/src/index.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { neostandard, resolveIgnoresFromGitignore } from 'neostandard'
|
|
2
2
|
import sonarjsConfig from './sonarjs.js'
|
|
3
3
|
import jsdocConfig from './jsdoc.js'
|
|
4
|
+
import unicornConfig from './unicorn.js'
|
|
4
5
|
|
|
5
6
|
/**
|
|
6
7
|
* Shared ESLint flat config for LIS JavaScript/Node.js repos.
|
|
@@ -21,6 +22,7 @@ export default [
|
|
|
21
22
|
}),
|
|
22
23
|
sonarjsConfig,
|
|
23
24
|
jsdocConfig,
|
|
25
|
+
unicornConfig,
|
|
24
26
|
{
|
|
25
27
|
languageOptions: {
|
|
26
28
|
ecmaVersion: 2025
|
package/src/unicorn.js
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import unicorn from 'eslint-plugin-unicorn'
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Unicorn-derived ESLint flat config entry.
|
|
5
|
+
*
|
|
6
|
+
* Some rules in the Defra JavaScript Standard SonarQube quality profile are
|
|
7
|
+
* Sonar's ports of eslint-plugin-unicorn rules, and eslint-plugin-sonarjs
|
|
8
|
+
* does not ship them. Only those rules are enabled here, not the plugin's
|
|
9
|
+
* recommended set. Severity follows sonarjs.js: MINOR/INFO -> warn. Each
|
|
10
|
+
* rule is commented with its Sonar key and priority.
|
|
11
|
+
*/
|
|
12
|
+
export default {
|
|
13
|
+
plugins: { unicorn },
|
|
14
|
+
rules: {
|
|
15
|
+
'unicorn/prefer-set-has': 'warn' // S7776 MINOR
|
|
16
|
+
}
|
|
17
|
+
}
|