@w5s/eslint-config 2.2.5 → 2.3.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/dist/rules/es/node.d.ts +3 -0
- package/dist/rules/es/node.js +20 -0
- package/dist/rules/es.js +2 -1
- package/dist/rules/ignore.js +3 -1
- package/dist/tsconfig.build.tsbuildinfo +1 -1
- package/package.json +5 -4
- package/src/rules/es/node.ts +21 -0
- package/src/rules/es.ts +3 -0
- package/src/rules/ignore.ts +2 -0
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
const config = {
|
|
3
|
+
extends: [],
|
|
4
|
+
plugins: ['n'],
|
|
5
|
+
rules: {
|
|
6
|
+
// 'n/handle-callback-err': ['error', '^(err|error|_error)$'],
|
|
7
|
+
'n/no-deprecated-api': 'error',
|
|
8
|
+
'n/no-exports-assign': 'error',
|
|
9
|
+
'n/no-new-require': 'error',
|
|
10
|
+
'n/no-path-concat': 'error',
|
|
11
|
+
'n/no-sync': 'error',
|
|
12
|
+
'n/prefer-global/buffer': ['error', 'never'],
|
|
13
|
+
'n/prefer-global/console': ['error', 'always'],
|
|
14
|
+
'n/prefer-global/process': ['error', 'never'],
|
|
15
|
+
'n/prefer-global/url': ['error', 'always'],
|
|
16
|
+
'n/prefer-global/url-search-params': ['error', 'always'],
|
|
17
|
+
'n/process-exit-as-throw': 'error',
|
|
18
|
+
},
|
|
19
|
+
};
|
|
20
|
+
module.exports = config;
|
package/dist/rules/es.js
CHANGED
|
@@ -8,6 +8,7 @@ const promise_js_1 = __importDefault(require("./es/promise.js"));
|
|
|
8
8
|
const jsdoc_js_1 = __importDefault(require("./es/jsdoc.js"));
|
|
9
9
|
const import_js_1 = __importDefault(require("./es/import.js"));
|
|
10
10
|
const unicorn_js_1 = __importDefault(require("./es/unicorn.js"));
|
|
11
|
+
const node_js_1 = __importDefault(require("./es/node.js"));
|
|
11
12
|
// import prettierConfig from './prettier.js';
|
|
12
|
-
const config = dev_1.ESLintConfig.concat(base_js_1.default, promise_js_1.default, jsdoc_js_1.default, import_js_1.default, unicorn_js_1.default);
|
|
13
|
+
const config = dev_1.ESLintConfig.concat(base_js_1.default, promise_js_1.default, jsdoc_js_1.default, import_js_1.default, unicorn_js_1.default, node_js_1.default);
|
|
13
14
|
module.exports = config;
|
package/dist/rules/ignore.js
CHANGED
|
@@ -4,12 +4,14 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
4
4
|
};
|
|
5
5
|
const node_fs_1 = require("node:fs");
|
|
6
6
|
const node_path_1 = __importDefault(require("node:path"));
|
|
7
|
+
const node_process_1 = __importDefault(require("node:process"));
|
|
7
8
|
const find_up_1 = __importDefault(require("find-up"));
|
|
8
9
|
const parse_gitignore_1 = __importDefault(require("parse-gitignore"));
|
|
9
10
|
const getGitignore = (prefix = '') => {
|
|
10
|
-
const cwd =
|
|
11
|
+
const cwd = node_process_1.default.cwd();
|
|
11
12
|
const gitIgnoreFile = find_up_1.default.sync(node_path_1.default.join(prefix, '.gitignore'), { cwd });
|
|
12
13
|
if (gitIgnoreFile != null) {
|
|
14
|
+
// eslint-disable-next-line n/no-sync
|
|
13
15
|
const { patterns } = parse_gitignore_1.default.parse((0, node_fs_1.readFileSync)(gitIgnoreFile));
|
|
14
16
|
const returnValue = patterns.map((pattern) => node_path_1.default.join(prefix, pattern));
|
|
15
17
|
return returnValue;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"root":["../src/es.ts","../src/index.ts","../src/jest.ts","../src/json.ts","../src/typescript.ts","../src/yml.ts","../src/rules/es.ts","../src/rules/ignore.ts","../src/rules/jest.ts","../src/rules/jsonc.ts","../src/rules/prettier.ts","../src/rules/typescript.ts","../src/rules/yml.ts","../src/rules/es/base.ts","../src/rules/es/import.ts","../src/rules/es/jsdoc.ts","../src/rules/es/promise.ts","../src/rules/es/unicorn.ts"],"version":"5.7.2"}
|
|
1
|
+
{"root":["../src/es.ts","../src/index.ts","../src/jest.ts","../src/json.ts","../src/typescript.ts","../src/yml.ts","../src/rules/es.ts","../src/rules/ignore.ts","../src/rules/jest.ts","../src/rules/jsonc.ts","../src/rules/prettier.ts","../src/rules/typescript.ts","../src/rules/yml.ts","../src/rules/es/base.ts","../src/rules/es/import.ts","../src/rules/es/jsdoc.ts","../src/rules/es/node.ts","../src/rules/es/promise.ts","../src/rules/es/unicorn.ts"],"version":"5.7.2"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@w5s/eslint-config",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.3.0",
|
|
4
4
|
"description": "ESLint configuration presets",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"eslint",
|
|
@@ -36,14 +36,15 @@
|
|
|
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.
|
|
40
|
-
"@w5s/prettier-config": "^2.2.
|
|
39
|
+
"@w5s/dev": "^2.3.0",
|
|
40
|
+
"@w5s/prettier-config": "^2.2.6",
|
|
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",
|
|
44
44
|
"eslint-plugin-jest": "^28.0.0",
|
|
45
45
|
"eslint-plugin-jsdoc": "^50.0.0",
|
|
46
46
|
"eslint-plugin-jsonc": "^2.4.0",
|
|
47
|
+
"eslint-plugin-n": "^17.0.0",
|
|
47
48
|
"eslint-plugin-prettier": "^5.0.0-alpha.0",
|
|
48
49
|
"eslint-plugin-promise": "^7.0.0",
|
|
49
50
|
"eslint-plugin-unicorn": "^56.0.0",
|
|
@@ -71,5 +72,5 @@
|
|
|
71
72
|
"access": "public"
|
|
72
73
|
},
|
|
73
74
|
"sideEffect": false,
|
|
74
|
-
"gitHead": "
|
|
75
|
+
"gitHead": "2e302c874daea8739aee214365edff536ae5c263"
|
|
75
76
|
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import type eslint from 'eslint';
|
|
2
|
+
|
|
3
|
+
const config: eslint.Linter.Config = {
|
|
4
|
+
extends: [],
|
|
5
|
+
plugins: ['n'],
|
|
6
|
+
rules: {
|
|
7
|
+
// 'n/handle-callback-err': ['error', '^(err|error|_error)$'],
|
|
8
|
+
'n/no-deprecated-api': 'error',
|
|
9
|
+
'n/no-exports-assign': 'error',
|
|
10
|
+
'n/no-new-require': 'error',
|
|
11
|
+
'n/no-path-concat': 'error',
|
|
12
|
+
'n/no-sync': 'error',
|
|
13
|
+
'n/prefer-global/buffer': ['error', 'never'],
|
|
14
|
+
'n/prefer-global/console': ['error', 'always'],
|
|
15
|
+
'n/prefer-global/process': ['error', 'never'],
|
|
16
|
+
'n/prefer-global/url': ['error', 'always'],
|
|
17
|
+
'n/prefer-global/url-search-params': ['error', 'always'],
|
|
18
|
+
'n/process-exit-as-throw': 'error',
|
|
19
|
+
},
|
|
20
|
+
};
|
|
21
|
+
export = config;
|
package/src/rules/es.ts
CHANGED
|
@@ -5,6 +5,8 @@ import promiseConfig from './es/promise.js';
|
|
|
5
5
|
import jsdocConfig from './es/jsdoc.js';
|
|
6
6
|
import importConfig from './es/import.js';
|
|
7
7
|
import unicornConfig from './es/unicorn.js';
|
|
8
|
+
import nodeConfig from './es/node.js';
|
|
9
|
+
|
|
8
10
|
// import prettierConfig from './prettier.js';
|
|
9
11
|
|
|
10
12
|
const config: eslint.Linter.Config = ESLintConfig.concat(
|
|
@@ -13,6 +15,7 @@ const config: eslint.Linter.Config = ESLintConfig.concat(
|
|
|
13
15
|
jsdocConfig,
|
|
14
16
|
importConfig,
|
|
15
17
|
unicornConfig,
|
|
18
|
+
nodeConfig,
|
|
16
19
|
// prettierConfig
|
|
17
20
|
);
|
|
18
21
|
export = config;
|
package/src/rules/ignore.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { readFileSync } from 'node:fs';
|
|
2
2
|
import nodePath from 'node:path';
|
|
3
|
+
import process from 'node:process';
|
|
3
4
|
import type eslint from 'eslint';
|
|
4
5
|
import findUp from 'find-up';
|
|
5
6
|
import parseGitignore from 'parse-gitignore';
|
|
@@ -8,6 +9,7 @@ const getGitignore = (prefix = '') => {
|
|
|
8
9
|
const cwd = process.cwd();
|
|
9
10
|
const gitIgnoreFile = findUp.sync(nodePath.join(prefix, '.gitignore'), { cwd });
|
|
10
11
|
if (gitIgnoreFile != null) {
|
|
12
|
+
// eslint-disable-next-line n/no-sync
|
|
11
13
|
const { patterns } = parseGitignore.parse(readFileSync(gitIgnoreFile));
|
|
12
14
|
const returnValue = patterns.map((pattern) => nodePath.join(prefix, pattern));
|
|
13
15
|
return returnValue;
|