@zukhruf/eslint 0.8.11 → 0.8.13
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
CHANGED
|
@@ -273,7 +273,7 @@ If the app installs an npm polyfill that has a Node module's name, allow it: `'i
|
|
|
273
273
|
|
|
274
274
|
Node and JavaScript add APIs that replace older code. `modern-node/recommended` reports the older code on each lint run, so a repo learns about a replacement and no person has to look for it.
|
|
275
275
|
|
|
276
|
-
The config is for code that runs on Node. Keep a browser bundle out of it
|
|
276
|
+
The config is for code that runs on Node. Keep a browser bundle out of it. When a project has its own `eslint.config` that spreads the root config, ESLint resolves each glob from the folder of the project, so `ignores` in the root does not apply there. In that repo, add this config to the config of each Node project. Check the result with `eslint --print-config` in a browser project. `Error.isError` and `Uint8Array.prototype.toHex` do not work in all the browsers that people use, so the fix can throw in a browser.
|
|
277
277
|
|
|
278
278
|
`@zukhruf/eslint/modern-node` needs `@e18e/eslint-plugin` and `eslint-plugin-unicorn`. `eslint-plugin-unicorn` 79 needs ESLint 10.4 or later.
|
|
279
279
|
|
|
@@ -291,8 +291,8 @@ The config turns on:
|
|
|
291
291
|
- `modern-node/crypto-hash`: `createHash(algorithm).update(data).digest(encoding)` becomes `hash(algorithm, data, encoding)` of `node:crypto`. `createHash` stays for several updates and for a stream. When the file already has a different `hash`, the rule reports and does not fix. Rename that `hash`, and the fix applies.
|
|
292
292
|
- e18e's `modernization` config, without `prefer-array-fill`, `prefer-array-to-spliced` and `prefer-spread-syntax`;
|
|
293
293
|
- `e18e/prefer-exponentiation-operator` and `e18e/prefer-flatmap-over-map-flat`;
|
|
294
|
-
- `
|
|
295
|
-
- `unicorn/prefer-
|
|
294
|
+
- `unicorn/no-new-buffer`, `prefer-abort-signal-any`, `prefer-array-from-async`, `prefer-error-is-error`, `prefer-group-by`, `prefer-import-meta-properties`, `prefer-iterator-helpers`, `prefer-promise-with-resolvers`, `prefer-set-methods`, `prefer-uint8array-hex` and `prefer-url-search-parameters`;
|
|
295
|
+
- `unicorn/prefer-dispose`, for TypeScript files only. It needs type information, which `zukhruf/base` gives. A repo that lints TypeScript with no type information must turn it off.
|
|
296
296
|
|
|
297
297
|
`unicorn/prefer-uint8array-hex` needs Node 26. Code that runs on Node 24 turns it off: `'unicorn/prefer-uint8array-hex': 'off'`.
|
|
298
298
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"plugin.d.ts","sourceRoot":"","sources":["../../src/modern-node/plugin.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAU,MAAM,EAAE,MAAM,QAAQ,CAAC;AAa7C;;;GAGG;AACH,QAAA,MAAM,MAAM;;;;;;;;;CAIa,CAAC;
|
|
1
|
+
{"version":3,"file":"plugin.d.ts","sourceRoot":"","sources":["../../src/modern-node/plugin.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAU,MAAM,EAAE,MAAM,QAAQ,CAAC;AAa7C;;;GAGG;AACH,QAAA,MAAM,MAAM;;;;;;;;;CAIa,CAAC;AA+C1B,eAAe,MAAM,CAAC"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import e18e from '@e18e/eslint-plugin';
|
|
2
2
|
import unicorn from 'eslint-plugin-unicorn';
|
|
3
3
|
import { defineConfig } from 'eslint/config';
|
|
4
|
-
import { SOURCE } from "../files.js";
|
|
4
|
+
import { SOURCE, TYPESCRIPT } from "../files.js";
|
|
5
5
|
import cryptoHash from "./crypto-hash.js";
|
|
6
6
|
const rules = {
|
|
7
7
|
'crypto-hash': cryptoHash,
|
|
@@ -16,23 +16,6 @@ const plugin = {
|
|
|
16
16
|
rules,
|
|
17
17
|
configs,
|
|
18
18
|
};
|
|
19
|
-
// e18e/ban-dependencies gives these packages only a different package, such as
|
|
20
|
-
// express to h3. That is a choice of the repo, not a new API. The rule has no
|
|
21
|
-
// option for the type of replacement (ADR 0008).
|
|
22
|
-
const ONLY_A_DIFFERENT_PACKAGE = [
|
|
23
|
-
'debug',
|
|
24
|
-
'detect-package-manager',
|
|
25
|
-
'execa',
|
|
26
|
-
'express',
|
|
27
|
-
'fast-glob',
|
|
28
|
-
'glob',
|
|
29
|
-
'gray-matter',
|
|
30
|
-
'js-yaml',
|
|
31
|
-
'ora',
|
|
32
|
-
'semver',
|
|
33
|
-
'tar-stream',
|
|
34
|
-
'yargs',
|
|
35
|
-
];
|
|
36
19
|
configs['recommended'] = defineConfig({
|
|
37
20
|
name: 'modern-node/recommended/plugins',
|
|
38
21
|
plugins: { 'modern-node': plugin, e18e, unicorn },
|
|
@@ -42,7 +25,6 @@ configs['recommended'] = defineConfig({
|
|
|
42
25
|
extends: [e18e.configs.modernization],
|
|
43
26
|
rules: {
|
|
44
27
|
'modern-node/crypto-hash': 'error',
|
|
45
|
-
'e18e/ban-dependencies': ['error', { allowed: ONLY_A_DIFFERENT_PACKAGE }],
|
|
46
28
|
// The fixer changes a.concat(b) to [...a, b]. When b is an array, the
|
|
47
29
|
// result changes and no error occurs.
|
|
48
30
|
'e18e/prefer-spread-syntax': 'off',
|
|
@@ -53,6 +35,9 @@ configs['recommended'] = defineConfig({
|
|
|
53
35
|
'e18e/prefer-array-fill': 'off',
|
|
54
36
|
'e18e/prefer-exponentiation-operator': 'error',
|
|
55
37
|
'e18e/prefer-flatmap-over-map-flat': 'error',
|
|
38
|
+
'unicorn/no-new-buffer': 'error',
|
|
39
|
+
'unicorn/prefer-abort-signal-any': 'error',
|
|
40
|
+
'unicorn/prefer-array-from-async': 'error',
|
|
56
41
|
'unicorn/prefer-error-is-error': 'error',
|
|
57
42
|
'unicorn/prefer-group-by': 'error',
|
|
58
43
|
'unicorn/prefer-import-meta-properties': 'error',
|
|
@@ -60,6 +45,15 @@ configs['recommended'] = defineConfig({
|
|
|
60
45
|
'unicorn/prefer-promise-with-resolvers': 'error',
|
|
61
46
|
'unicorn/prefer-set-methods': 'error',
|
|
62
47
|
'unicorn/prefer-uint8array-hex': 'error',
|
|
48
|
+
'unicorn/prefer-url-search-parameters': 'error',
|
|
49
|
+
},
|
|
50
|
+
}, {
|
|
51
|
+
name: 'modern-node/recommended/typescript',
|
|
52
|
+
files: TYPESCRIPT,
|
|
53
|
+
rules: {
|
|
54
|
+
// Only types prove that a value has a disposer. In a JavaScript file the
|
|
55
|
+
// rule reports each close(), and the fix throws at run time (ADR 0008).
|
|
56
|
+
'unicorn/prefer-dispose': 'error',
|
|
63
57
|
},
|
|
64
58
|
});
|
|
65
59
|
export default plugin;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"plugin.js","sourceRoot":"","sources":["../../src/modern-node/plugin.ts"],"names":[],"mappings":"AAAA,OAAO,IAAI,MAAM,qBAAqB,CAAC;AAEvC,OAAO,OAAO,MAAM,uBAAuB,CAAC;AAC5C,OAAO,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC;AAE7C,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;
|
|
1
|
+
{"version":3,"file":"plugin.js","sourceRoot":"","sources":["../../src/modern-node/plugin.ts"],"names":[],"mappings":"AAAA,OAAO,IAAI,MAAM,qBAAqB,CAAC;AAEvC,OAAO,OAAO,MAAM,uBAAuB,CAAC;AAC5C,OAAO,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC;AAE7C,OAAO,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACjD,OAAO,UAAU,MAAM,kBAAkB,CAAC;AAE1C,MAAM,KAAK,GAAG;IACZ,aAAa,EAAE,UAAU;CAC1B,CAAC;AAEF,MAAM,OAAO,GAAoC,EAAE,CAAC;AAEpD;;;GAGG;AACH,MAAM,MAAM,GAAG;IACb,IAAI,EAAE,EAAE,IAAI,EAAE,6BAA6B,EAAE,SAAS,EAAE,aAAa,EAAE;IACvE,KAAK;IACL,OAAO;CACgB,CAAC;AAE1B,OAAO,CAAC,aAAa,CAAC,GAAG,YAAY,CACnC;IACE,IAAI,EAAE,iCAAiC;IACvC,OAAO,EAAE,EAAE,aAAa,EAAE,MAAM,EAAE,IAAI,EAAE,OAAO,EAAE;CAClD,EACD;IACE,IAAI,EAAE,yBAAyB;IAC/B,KAAK,EAAE,MAAM;IACb,OAAO,EAAE,CAAC,IAAI,CAAC,OAAO,CAAC,aAAa,CAAC;IACrC,KAAK,EAAE;QACL,yBAAyB,EAAE,OAAO;QAClC,sEAAsE;QACtE,sCAAsC;QACtC,2BAA2B,EAAE,KAAK;QAClC,wEAAwE;QACxE,4DAA4D;QAC5D,8BAA8B,EAAE,KAAK;QACrC,yDAAyD;QACzD,wBAAwB,EAAE,KAAK;QAC/B,qCAAqC,EAAE,OAAO;QAC9C,mCAAmC,EAAE,OAAO;QAC5C,uBAAuB,EAAE,OAAO;QAChC,iCAAiC,EAAE,OAAO;QAC1C,iCAAiC,EAAE,OAAO;QAC1C,+BAA+B,EAAE,OAAO;QACxC,yBAAyB,EAAE,OAAO;QAClC,uCAAuC,EAAE,OAAO;QAChD,iCAAiC,EAAE,OAAO;QAC1C,uCAAuC,EAAE,OAAO;QAChD,4BAA4B,EAAE,OAAO;QACrC,+BAA+B,EAAE,OAAO;QACxC,sCAAsC,EAAE,OAAO;KAChD;CACF,EACD;IACE,IAAI,EAAE,oCAAoC;IAC1C,KAAK,EAAE,UAAU;IACjB,KAAK,EAAE;QACL,yEAAyE;QACzE,wEAAwE;QACxE,wBAAwB,EAAE,OAAO;KAClC;CACF,CACF,CAAC;AAEF,eAAe,MAAM,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@zukhruf/eslint",
|
|
3
|
-
"version": "0.8.
|
|
3
|
+
"version": "0.8.13",
|
|
4
4
|
"description": "ESLint rules and configs shared across workspaces. Every check is its own named rule, so a repo's own config cannot silently erase it.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": {
|
|
@@ -68,7 +68,7 @@
|
|
|
68
68
|
"ts-api-utils": "^2.5.0"
|
|
69
69
|
},
|
|
70
70
|
"devDependencies": {
|
|
71
|
-
"@zukhruf/testing": "^0.8.
|
|
71
|
+
"@zukhruf/testing": "^0.8.13"
|
|
72
72
|
},
|
|
73
73
|
"peerDependencies": {
|
|
74
74
|
"@e18e/eslint-plugin": "^0.8.1",
|