@w5s/eslint-config 1.0.8 → 1.0.10
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/lib/ignore.js +10 -4
- package/lib/typescript.js +1 -0
- package/package.json +3 -3
- package/src/ignore.ts +10 -5
- package/src/typescript.ts +1 -0
package/lib/ignore.js
CHANGED
|
@@ -5,10 +5,14 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
5
5
|
const node_fs_1 = require("node:fs");
|
|
6
6
|
const find_up_1 = __importDefault(require("find-up"));
|
|
7
7
|
const parse_gitignore_1 = __importDefault(require("parse-gitignore"));
|
|
8
|
-
const
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
8
|
+
const node_path_1 = require("node:path");
|
|
9
|
+
const getGitignore = (prefix = '') => {
|
|
10
|
+
const cwd = process.cwd();
|
|
11
|
+
const gitIgnoreFile = find_up_1.default.sync((0, node_path_1.join)(prefix, '.gitignore'), { cwd });
|
|
12
|
+
if (gitIgnoreFile != null) {
|
|
13
|
+
const { patterns } = parse_gitignore_1.default.parse((0, node_fs_1.readFileSync)(gitIgnoreFile));
|
|
14
|
+
const returnValue = patterns.map((pattern) => (0, node_path_1.join)(prefix, pattern));
|
|
15
|
+
return returnValue;
|
|
12
16
|
}
|
|
13
17
|
return [];
|
|
14
18
|
};
|
|
@@ -35,6 +39,8 @@ const config = {
|
|
|
35
39
|
'_generated_/',
|
|
36
40
|
'*.toml',
|
|
37
41
|
...getGitignore(),
|
|
42
|
+
...getGitignore('android'),
|
|
43
|
+
...getGitignore('ios'),
|
|
38
44
|
],
|
|
39
45
|
};
|
|
40
46
|
module.exports = config;
|
package/lib/typescript.js
CHANGED
|
@@ -166,6 +166,7 @@ const config = dev_1.ESLintConfig.concat(
|
|
|
166
166
|
...baseImportRules['import/no-extraneous-dependencies'][1],
|
|
167
167
|
devDependencies: baseImportRules['import/no-extraneous-dependencies'][1].devDependencies.reduce((result, devDep) => {
|
|
168
168
|
const toAppend = [devDep];
|
|
169
|
+
// eslint-disable-next-line unicorn/prefer-string-replace-all
|
|
169
170
|
const devDepWithTs = devDep.replace(/\bjs(x?)\b/g, 'ts$1');
|
|
170
171
|
if (devDepWithTs !== devDep) {
|
|
171
172
|
toAppend.push(devDepWithTs);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@w5s/eslint-config",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.10",
|
|
4
4
|
"description": "ESLint configuration presets",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"eslint",
|
|
@@ -63,7 +63,7 @@
|
|
|
63
63
|
"eslint-plugin-jsonc": "^2.4.0",
|
|
64
64
|
"eslint-plugin-prettier": "^4.0.0",
|
|
65
65
|
"eslint-plugin-promise": "^6.0.0",
|
|
66
|
-
"eslint-plugin-unicorn": "^
|
|
66
|
+
"eslint-plugin-unicorn": "^47.0.0",
|
|
67
67
|
"eslint-plugin-yml": "^1.1.0",
|
|
68
68
|
"find-up": "^5.0.0",
|
|
69
69
|
"parse-gitignore": "^2.0.0"
|
|
@@ -102,5 +102,5 @@
|
|
|
102
102
|
"publishConfig": {
|
|
103
103
|
"access": "public"
|
|
104
104
|
},
|
|
105
|
-
"gitHead": "
|
|
105
|
+
"gitHead": "128fbd2cdc468360ea0c0834401ea99780e5c622"
|
|
106
106
|
}
|
package/src/ignore.ts
CHANGED
|
@@ -2,13 +2,16 @@ import type eslint from 'eslint';
|
|
|
2
2
|
import { readFileSync } from 'node:fs';
|
|
3
3
|
import findUp from 'find-up';
|
|
4
4
|
import parseGitignore from 'parse-gitignore';
|
|
5
|
+
import { join as pathJoin } from 'node:path';
|
|
5
6
|
|
|
6
|
-
const getGitignore = () => {
|
|
7
|
-
const
|
|
8
|
-
|
|
9
|
-
|
|
7
|
+
const getGitignore = (prefix = '') => {
|
|
8
|
+
const cwd = process.cwd();
|
|
9
|
+
const gitIgnoreFile = findUp.sync(pathJoin(prefix, '.gitignore'), { cwd });
|
|
10
|
+
if (gitIgnoreFile != null) {
|
|
11
|
+
const { patterns } = parseGitignore.parse(readFileSync(gitIgnoreFile));
|
|
12
|
+
const returnValue = patterns.map((pattern) => pathJoin(prefix, pattern));
|
|
13
|
+
return returnValue;
|
|
10
14
|
}
|
|
11
|
-
|
|
12
15
|
return [];
|
|
13
16
|
};
|
|
14
17
|
|
|
@@ -35,6 +38,8 @@ const config: eslint.Linter.Config = {
|
|
|
35
38
|
'_generated_/',
|
|
36
39
|
'*.toml',
|
|
37
40
|
...getGitignore(),
|
|
41
|
+
...getGitignore('android'),
|
|
42
|
+
...getGitignore('ios'),
|
|
38
43
|
],
|
|
39
44
|
};
|
|
40
45
|
|
package/src/typescript.ts
CHANGED
|
@@ -168,6 +168,7 @@ const config: eslint.Linter.Config = ESLintConfig.concat(
|
|
|
168
168
|
devDependencies: baseImportRules['import/no-extraneous-dependencies'][1].devDependencies.reduce(
|
|
169
169
|
(result: string[], devDep: string) => {
|
|
170
170
|
const toAppend = [devDep];
|
|
171
|
+
// eslint-disable-next-line unicorn/prefer-string-replace-all
|
|
171
172
|
const devDepWithTs = devDep.replace(/\bjs(x?)\b/g, 'ts$1');
|
|
172
173
|
if (devDepWithTs !== devDep) {
|
|
173
174
|
toAppend.push(devDepWithTs);
|