@w5s/eslint-config 2.1.1 → 2.1.2
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/dist/rules/es/unicorn.js
CHANGED
|
@@ -4,8 +4,8 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
4
4
|
};
|
|
5
5
|
const dev_1 = require("@w5s/dev");
|
|
6
6
|
// @ts-ignore unicorn config is not typed
|
|
7
|
-
const
|
|
8
|
-
const config = dev_1.ESLintConfig.concat(
|
|
7
|
+
const eslint_plugin_unicorn_1 = __importDefault(require("eslint-plugin-unicorn"));
|
|
8
|
+
const config = dev_1.ESLintConfig.concat(eslint_plugin_unicorn_1.default.configs.recommended, {
|
|
9
9
|
// extends: ['plugin:unicorn/recommended'],
|
|
10
10
|
plugins: ['unicorn'],
|
|
11
11
|
rules: {
|
package/dist/rules/ignore.js
CHANGED
|
@@ -3,15 +3,15 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
const node_fs_1 = require("node:fs");
|
|
6
|
-
const node_path_1 = require("node:path");
|
|
6
|
+
const node_path_1 = __importDefault(require("node:path"));
|
|
7
7
|
const find_up_1 = __importDefault(require("find-up"));
|
|
8
8
|
const parse_gitignore_1 = __importDefault(require("parse-gitignore"));
|
|
9
9
|
const getGitignore = (prefix = '') => {
|
|
10
10
|
const cwd = process.cwd();
|
|
11
|
-
const gitIgnoreFile = find_up_1.default.sync(
|
|
11
|
+
const gitIgnoreFile = find_up_1.default.sync(node_path_1.default.join(prefix, '.gitignore'), { cwd });
|
|
12
12
|
if (gitIgnoreFile != null) {
|
|
13
13
|
const { patterns } = parse_gitignore_1.default.parse((0, node_fs_1.readFileSync)(gitIgnoreFile));
|
|
14
|
-
const returnValue = patterns.map((pattern) =>
|
|
14
|
+
const returnValue = patterns.map((pattern) => node_path_1.default.join(prefix, pattern));
|
|
15
15
|
return returnValue;
|
|
16
16
|
}
|
|
17
17
|
return [];
|
package/dist/rules/typescript.js
CHANGED
|
@@ -7,9 +7,9 @@ const base_js_1 = __importDefault(require("./es/base.js"));
|
|
|
7
7
|
const import_js_1 = __importDefault(require("./es/import.js"));
|
|
8
8
|
// Inspired by https://github.com/iamturns/eslint-config-airbnb-typescript/blob/master/lib/shared.js
|
|
9
9
|
// Fix Hack : TS plugin seems to modify the rules
|
|
10
|
-
const deepClone = (anyValue) =>
|
|
11
|
-
const baseRules = deepClone(base_js_1.default.rules);
|
|
12
|
-
const baseImportRules = deepClone(import_js_1.default.rules);
|
|
10
|
+
const deepClone = (anyValue) => structuredClone(anyValue);
|
|
11
|
+
const baseRules = deepClone(base_js_1.default.rules) ?? {};
|
|
12
|
+
const baseImportRules = deepClone(import_js_1.default.rules) ?? {};
|
|
13
13
|
const duplicateTSC = 'off'; // = "off because tsc already checks that"
|
|
14
14
|
const config = dev_1.ESLintConfig.concat(
|
|
15
15
|
/**
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@w5s/eslint-config",
|
|
3
|
-
"version": "2.1.
|
|
3
|
+
"version": "2.1.2",
|
|
4
4
|
"description": "ESLint configuration presets",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"eslint",
|
|
@@ -36,8 +36,8 @@
|
|
|
36
36
|
"@rushstack/eslint-patch": "^1.1.0",
|
|
37
37
|
"@typescript-eslint/eslint-plugin": "^8.0.0",
|
|
38
38
|
"@typescript-eslint/parser": "^8.0.0",
|
|
39
|
-
"@w5s/dev": "^2.2.
|
|
40
|
-
"@w5s/prettier-config": "^2.1.
|
|
39
|
+
"@w5s/dev": "^2.2.14",
|
|
40
|
+
"@w5s/prettier-config": "^2.1.1",
|
|
41
41
|
"eslint-config-airbnb-base": "^15.0.0",
|
|
42
42
|
"eslint-config-prettier": "^9.0.0",
|
|
43
43
|
"eslint-plugin-import": "^2.25.0",
|
|
@@ -46,7 +46,7 @@
|
|
|
46
46
|
"eslint-plugin-jsonc": "^2.4.0",
|
|
47
47
|
"eslint-plugin-prettier": "^5.0.0-alpha.0",
|
|
48
48
|
"eslint-plugin-promise": "^7.0.0",
|
|
49
|
-
"eslint-plugin-unicorn": "^
|
|
49
|
+
"eslint-plugin-unicorn": "^55.0.0",
|
|
50
50
|
"eslint-plugin-yml": "^1.1.0",
|
|
51
51
|
"find-up": "^5.0.0",
|
|
52
52
|
"parse-gitignore": "^2.0.0"
|
|
@@ -71,5 +71,5 @@
|
|
|
71
71
|
"access": "public"
|
|
72
72
|
},
|
|
73
73
|
"sideEffect": false,
|
|
74
|
-
"gitHead": "
|
|
74
|
+
"gitHead": "32d8a56d70ab85a77beaa69019765e923f5a80f1"
|
|
75
75
|
}
|
package/src/rules/es/unicorn.ts
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { ESLintConfig } from '@w5s/dev';
|
|
2
2
|
import type eslint from 'eslint';
|
|
3
3
|
// @ts-ignore unicorn config is not typed
|
|
4
|
-
import unicornConfig from 'eslint-plugin-unicorn
|
|
4
|
+
import unicornConfig from 'eslint-plugin-unicorn';
|
|
5
5
|
|
|
6
6
|
const config: eslint.Linter.Config = ESLintConfig.concat(
|
|
7
|
-
unicornConfig,
|
|
7
|
+
unicornConfig.configs.recommended,
|
|
8
8
|
{
|
|
9
9
|
// extends: ['plugin:unicorn/recommended'],
|
|
10
10
|
plugins: ['unicorn'],
|
package/src/rules/ignore.ts
CHANGED
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
import { readFileSync } from 'node:fs';
|
|
2
|
-
import
|
|
2
|
+
import nodePath from 'node:path';
|
|
3
3
|
import type eslint from 'eslint';
|
|
4
4
|
import findUp from 'find-up';
|
|
5
5
|
import parseGitignore from 'parse-gitignore';
|
|
6
6
|
|
|
7
7
|
const getGitignore = (prefix = '') => {
|
|
8
8
|
const cwd = process.cwd();
|
|
9
|
-
const gitIgnoreFile = findUp.sync(
|
|
9
|
+
const gitIgnoreFile = findUp.sync(nodePath.join(prefix, '.gitignore'), { cwd });
|
|
10
10
|
if (gitIgnoreFile != null) {
|
|
11
11
|
const { patterns } = parseGitignore.parse(readFileSync(gitIgnoreFile));
|
|
12
|
-
const returnValue = patterns.map((pattern) =>
|
|
12
|
+
const returnValue = patterns.map((pattern) => nodePath.join(prefix, pattern));
|
|
13
13
|
return returnValue;
|
|
14
14
|
}
|
|
15
15
|
return [];
|
package/src/rules/typescript.ts
CHANGED
|
@@ -6,9 +6,10 @@ import importConfig from './es/import.js';
|
|
|
6
6
|
// Inspired by https://github.com/iamturns/eslint-config-airbnb-typescript/blob/master/lib/shared.js
|
|
7
7
|
|
|
8
8
|
// Fix Hack : TS plugin seems to modify the rules
|
|
9
|
-
const deepClone =
|
|
10
|
-
|
|
11
|
-
const
|
|
9
|
+
const deepClone = <T extends Partial<eslint.Linter.RulesRecord> | undefined>(anyValue: T): any =>
|
|
10
|
+
structuredClone(anyValue);
|
|
11
|
+
const baseRules = deepClone(baseConfig.rules) ?? {};
|
|
12
|
+
const baseImportRules = deepClone(importConfig.rules) ?? {};
|
|
12
13
|
|
|
13
14
|
const duplicateTSC = 'off'; // = "off because tsc already checks that"
|
|
14
15
|
|