@w5s/dev 1.0.0-alpha.2 → 1.0.0-alpha.4
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/constant.d.ts +47 -0
- package/lib/constant.js +61 -0
- package/lib/constant.js.map +1 -0
- package/lib/eslint.d.ts +9 -0
- package/lib/eslint.js +47 -0
- package/lib/eslint.js.map +1 -0
- package/lib/index.d.ts +2 -46
- package/lib/index.js +16 -58
- package/lib/index.js.map +1 -1
- package/package.json +23 -3
- package/src/constant.ts +62 -0
- package/src/eslint.ts +48 -0
- package/src/index.ts +2 -62
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Supported ECMA version
|
|
3
|
+
*
|
|
4
|
+
* @example
|
|
5
|
+
* ```ts
|
|
6
|
+
* ECMA_VERSION // 2022
|
|
7
|
+
* ```
|
|
8
|
+
*/
|
|
9
|
+
export declare const ECMA_VERSION = 2022;
|
|
10
|
+
/**
|
|
11
|
+
* Files and folders to always ignore
|
|
12
|
+
*
|
|
13
|
+
* @example
|
|
14
|
+
* ```ts
|
|
15
|
+
* IGNORE_LIST // ['node_modules/', 'build/', ...]
|
|
16
|
+
* ```
|
|
17
|
+
*/
|
|
18
|
+
export declare const IGNORE_LIST: string[];
|
|
19
|
+
/**
|
|
20
|
+
* Supported file extensions
|
|
21
|
+
*
|
|
22
|
+
* @example
|
|
23
|
+
* ```ts
|
|
24
|
+
* EXTENSIONS // ['.ts', '.js', ...]
|
|
25
|
+
* ```
|
|
26
|
+
*/
|
|
27
|
+
export declare const EXTENSIONS: string[];
|
|
28
|
+
/**
|
|
29
|
+
* Supported file extensions without starting dots
|
|
30
|
+
*
|
|
31
|
+
* @example
|
|
32
|
+
* ```ts
|
|
33
|
+
* EXTENSIONS_WITHOUT_DOT // ['ts', 'js', ...]
|
|
34
|
+
* ```
|
|
35
|
+
*/
|
|
36
|
+
export declare const EXTENSIONS_WITHOUT_DOT: string[];
|
|
37
|
+
/**
|
|
38
|
+
* List of globs to find config related files
|
|
39
|
+
*
|
|
40
|
+
* @example
|
|
41
|
+
* ```ts
|
|
42
|
+
* CONFIG_GLOB_LIST // ['**\/.*.{js,cjs}', '**\/*.config.{js,cjs}']
|
|
43
|
+
* ```
|
|
44
|
+
*/
|
|
45
|
+
export declare const CONFIG_GLOB_LIST: string[];
|
|
46
|
+
export declare const EXTENSIONS_RESOURCES_REGEX = "\\.(css|sass|scss|less|gif|png|jpg|jpeg|svg|gql|graphql|yml|yaml)$";
|
|
47
|
+
//# sourceMappingURL=constant.d.ts.map
|
package/lib/constant.js
ADDED
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.EXTENSIONS_RESOURCES_REGEX = exports.CONFIG_GLOB_LIST = exports.EXTENSIONS_WITHOUT_DOT = exports.EXTENSIONS = exports.IGNORE_LIST = exports.ECMA_VERSION = void 0;
|
|
4
|
+
/**
|
|
5
|
+
* Supported ECMA version
|
|
6
|
+
*
|
|
7
|
+
* @example
|
|
8
|
+
* ```ts
|
|
9
|
+
* ECMA_VERSION // 2022
|
|
10
|
+
* ```
|
|
11
|
+
*/
|
|
12
|
+
exports.ECMA_VERSION = 2022;
|
|
13
|
+
/**
|
|
14
|
+
* Files and folders to always ignore
|
|
15
|
+
*
|
|
16
|
+
* @example
|
|
17
|
+
* ```ts
|
|
18
|
+
* IGNORE_LIST // ['node_modules/', 'build/', ...]
|
|
19
|
+
* ```
|
|
20
|
+
*/
|
|
21
|
+
exports.IGNORE_LIST = [
|
|
22
|
+
'node_modules/',
|
|
23
|
+
'build/',
|
|
24
|
+
'cjs/',
|
|
25
|
+
'coverage/',
|
|
26
|
+
'dist/',
|
|
27
|
+
'dts/',
|
|
28
|
+
'esm/',
|
|
29
|
+
'lib/',
|
|
30
|
+
'mjs/',
|
|
31
|
+
'umd/',
|
|
32
|
+
];
|
|
33
|
+
/**
|
|
34
|
+
* Supported file extensions
|
|
35
|
+
*
|
|
36
|
+
* @example
|
|
37
|
+
* ```ts
|
|
38
|
+
* EXTENSIONS // ['.ts', '.js', ...]
|
|
39
|
+
* ```
|
|
40
|
+
*/
|
|
41
|
+
exports.EXTENSIONS = ['.ts', '.tsx', '.cts', '.mts', '.js', '.jsx', '.cjs', '.mjs'];
|
|
42
|
+
/**
|
|
43
|
+
* Supported file extensions without starting dots
|
|
44
|
+
*
|
|
45
|
+
* @example
|
|
46
|
+
* ```ts
|
|
47
|
+
* EXTENSIONS_WITHOUT_DOT // ['ts', 'js', ...]
|
|
48
|
+
* ```
|
|
49
|
+
*/
|
|
50
|
+
exports.EXTENSIONS_WITHOUT_DOT = exports.EXTENSIONS.map((ext) => ext.slice(1));
|
|
51
|
+
/**
|
|
52
|
+
* List of globs to find config related files
|
|
53
|
+
*
|
|
54
|
+
* @example
|
|
55
|
+
* ```ts
|
|
56
|
+
* CONFIG_GLOB_LIST // ['**\/.*.{js,cjs}', '**\/*.config.{js,cjs}']
|
|
57
|
+
* ```
|
|
58
|
+
*/
|
|
59
|
+
exports.CONFIG_GLOB_LIST = ['**/.*.{js,cjs}', '**/*.config.{js,cjs}'];
|
|
60
|
+
exports.EXTENSIONS_RESOURCES_REGEX = '\\.(css|sass|scss|less|gif|png|jpg|jpeg|svg|gql|graphql|yml|yaml)$';
|
|
61
|
+
//# sourceMappingURL=constant.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"constant.js","sourceRoot":"","sources":["../src/constant.ts"],"names":[],"mappings":";;;AAAA;;;;;;;GAOG;AACU,QAAA,YAAY,GAAG,IAAI,CAAC;AAEjC;;;;;;;GAOG;AACU,QAAA,WAAW,GAAG;IACzB,eAAe;IACf,QAAQ;IACR,MAAM;IACN,WAAW;IACX,OAAO;IACP,MAAM;IACN,MAAM;IACN,MAAM;IACN,MAAM;IACN,MAAM;CACP,CAAC;AAEF;;;;;;;GAOG;AACU,QAAA,UAAU,GAAG,CAAC,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,CAAC;AAEzF;;;;;;;GAOG;AACU,QAAA,sBAAsB,GAAG,kBAAU,CAAC,GAAG,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC;AAE5E;;;;;;;GAOG;AACU,QAAA,gBAAgB,GAAG,CAAC,gBAAgB,EAAE,sBAAsB,CAAC,CAAC;AAE9D,QAAA,0BAA0B,GAAG,oEAAoE,CAAC"}
|
package/lib/eslint.d.ts
ADDED
package/lib/eslint.js
ADDED
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ESLintConfig = void 0;
|
|
4
|
+
function toArray(value) {
|
|
5
|
+
if (value == null) {
|
|
6
|
+
return [];
|
|
7
|
+
}
|
|
8
|
+
if (Array.isArray(value)) {
|
|
9
|
+
return value;
|
|
10
|
+
}
|
|
11
|
+
return [value];
|
|
12
|
+
}
|
|
13
|
+
function concatArray(left, right) {
|
|
14
|
+
return toArray(left).concat(toArray(right));
|
|
15
|
+
}
|
|
16
|
+
var ESLintConfig;
|
|
17
|
+
(function (ESLintConfig) {
|
|
18
|
+
/**
|
|
19
|
+
*
|
|
20
|
+
* @param configs
|
|
21
|
+
*/
|
|
22
|
+
function concat(...configs) {
|
|
23
|
+
return configs.reduce((returnValue, config) => ({
|
|
24
|
+
...returnValue,
|
|
25
|
+
...config,
|
|
26
|
+
env: { ...returnValue.env, ...config.env },
|
|
27
|
+
extends: concatArray(returnValue.extends, config.extends),
|
|
28
|
+
globals: { ...returnValue.globals, ...config.globals },
|
|
29
|
+
overrides: concatArray(returnValue.overrides, config.overrides),
|
|
30
|
+
parserOptions: { ...returnValue.parserOptions, ...config.parserOptions },
|
|
31
|
+
plugins: concatArray(returnValue.plugins, config.plugins),
|
|
32
|
+
rules: { ...returnValue.rules, ...config.rules },
|
|
33
|
+
settings: { ...returnValue.settings, ...config.settings },
|
|
34
|
+
}), {
|
|
35
|
+
env: {},
|
|
36
|
+
extends: [],
|
|
37
|
+
globals: {},
|
|
38
|
+
overrides: [],
|
|
39
|
+
parserOptions: {},
|
|
40
|
+
plugins: [],
|
|
41
|
+
rules: {},
|
|
42
|
+
settings: {},
|
|
43
|
+
});
|
|
44
|
+
}
|
|
45
|
+
ESLintConfig.concat = concat;
|
|
46
|
+
})(ESLintConfig = exports.ESLintConfig || (exports.ESLintConfig = {}));
|
|
47
|
+
//# sourceMappingURL=eslint.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"eslint.js","sourceRoot":"","sources":["../src/eslint.ts"],"names":[],"mappings":";;;AAEA,SAAS,OAAO,CAAI,KAA0B;IAC5C,IAAI,KAAK,IAAI,IAAI,EAAE;QACjB,OAAO,EAAE,CAAC;KACX;IACD,IAAI,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,EAAE;QACxB,OAAO,KAAK,CAAC;KACd;IACD,OAAO,CAAC,KAAK,CAAC,CAAC;AACjB,CAAC;AAED,SAAS,WAAW,CAAI,IAAyB,EAAE,KAA0B;IAC3E,OAAO,OAAO,CAAC,IAAI,CAAC,CAAC,MAAM,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC;AAC9C,CAAC;AAED,IAAiB,YAAY,CA+B5B;AA/BD,WAAiB,YAAY;IAC3B;;;OAGG;IACH,SAAgB,MAAM,CAAC,GAAG,OAA4B;QACpD,OAAO,OAAO,CAAC,MAAM,CACnB,CAAC,WAAW,EAAE,MAAM,EAAE,EAAE,CAAC,CAAC;YACxB,GAAG,WAAW;YACd,GAAG,MAAM;YACT,GAAG,EAAE,EAAE,GAAG,WAAW,CAAC,GAAG,EAAE,GAAG,MAAM,CAAC,GAAG,EAAE;YAC1C,OAAO,EAAE,WAAW,CAAC,WAAW,CAAC,OAAO,EAAE,MAAM,CAAC,OAAO,CAAC;YACzD,OAAO,EAAE,EAAE,GAAG,WAAW,CAAC,OAAO,EAAE,GAAG,MAAM,CAAC,OAAO,EAAE;YACtD,SAAS,EAAE,WAAW,CAAC,WAAW,CAAC,SAAS,EAAE,MAAM,CAAC,SAAS,CAAC;YAC/D,aAAa,EAAE,EAAE,GAAG,WAAW,CAAC,aAAa,EAAE,GAAG,MAAM,CAAC,aAAa,EAAE;YACxE,OAAO,EAAE,WAAW,CAAC,WAAW,CAAC,OAAO,EAAE,MAAM,CAAC,OAAO,CAAC;YACzD,KAAK,EAAE,EAAE,GAAG,WAAW,CAAC,KAAK,EAAE,GAAG,MAAM,CAAC,KAAK,EAAE;YAChD,QAAQ,EAAE,EAAE,GAAG,WAAW,CAAC,QAAQ,EAAE,GAAG,MAAM,CAAC,QAAQ,EAAE;SAC1D,CAAC,EACF;YACE,GAAG,EAAE,EAAE;YACP,OAAO,EAAE,EAAE;YACX,OAAO,EAAE,EAAE;YACX,SAAS,EAAE,EAAE;YACb,aAAa,EAAE,EAAE;YACjB,OAAO,EAAE,EAAE;YACX,KAAK,EAAE,EAAE;YACT,QAAQ,EAAE,EAAE;SACb,CACF,CAAC;IACJ,CAAC;IAzBe,mBAAM,SAyBrB,CAAA;AACH,CAAC,EA/BgB,YAAY,GAAZ,oBAAY,KAAZ,oBAAY,QA+B5B"}
|
package/lib/index.d.ts
CHANGED
|
@@ -1,47 +1,3 @@
|
|
|
1
|
-
|
|
2
|
-
*
|
|
3
|
-
*
|
|
4
|
-
* @example
|
|
5
|
-
* ```ts
|
|
6
|
-
* ECMA_VERSION // 2022
|
|
7
|
-
* ```
|
|
8
|
-
*/
|
|
9
|
-
export declare const ECMA_VERSION = 2022;
|
|
10
|
-
/**
|
|
11
|
-
* Files and folders to always ignore
|
|
12
|
-
*
|
|
13
|
-
* @example
|
|
14
|
-
* ```ts
|
|
15
|
-
* IGNORE_LIST // ['node_modules/', 'build/', ...]
|
|
16
|
-
* ```
|
|
17
|
-
*/
|
|
18
|
-
export declare const IGNORE_LIST: string[];
|
|
19
|
-
/**
|
|
20
|
-
* Supported file extensions
|
|
21
|
-
*
|
|
22
|
-
* @example
|
|
23
|
-
* ```ts
|
|
24
|
-
* EXTENSIONS // ['.ts', '.js', ...]
|
|
25
|
-
* ```
|
|
26
|
-
*/
|
|
27
|
-
export declare const EXTENSIONS: string[];
|
|
28
|
-
/**
|
|
29
|
-
* Supported file extensions without starting dots
|
|
30
|
-
*
|
|
31
|
-
* @example
|
|
32
|
-
* ```ts
|
|
33
|
-
* EXTENSIONS_WITHOUT_DOT // ['ts', 'js', ...]
|
|
34
|
-
* ```
|
|
35
|
-
*/
|
|
36
|
-
export declare const EXTENSIONS_WITHOUT_DOT: string[];
|
|
37
|
-
/**
|
|
38
|
-
* List of globs to find config related files
|
|
39
|
-
*
|
|
40
|
-
* @example
|
|
41
|
-
* ```ts
|
|
42
|
-
* CONFIG_GLOB_LIST // ['**\/.*.{js,cjs}', '**\/*.config.{js,cjs}']
|
|
43
|
-
* ```
|
|
44
|
-
*/
|
|
45
|
-
export declare const CONFIG_GLOB_LIST: string[];
|
|
46
|
-
export declare const EXTENSIONS_RESOURCES_REGEX = "\\.(css|sass|scss|less|gif|png|jpg|jpeg|svg|gql|graphql|yml|yaml)$";
|
|
1
|
+
export * from './constant.js';
|
|
2
|
+
export * from './eslint.js';
|
|
47
3
|
//# sourceMappingURL=index.d.ts.map
|
package/lib/index.js
CHANGED
|
@@ -1,61 +1,19 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
2
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
* Supported ECMA version
|
|
6
|
-
*
|
|
7
|
-
* @example
|
|
8
|
-
* ```ts
|
|
9
|
-
* ECMA_VERSION // 2022
|
|
10
|
-
* ```
|
|
11
|
-
*/
|
|
12
|
-
exports.ECMA_VERSION = 2022;
|
|
13
|
-
/**
|
|
14
|
-
* Files and folders to always ignore
|
|
15
|
-
*
|
|
16
|
-
* @example
|
|
17
|
-
* ```ts
|
|
18
|
-
* IGNORE_LIST // ['node_modules/', 'build/', ...]
|
|
19
|
-
* ```
|
|
20
|
-
*/
|
|
21
|
-
exports.IGNORE_LIST = [
|
|
22
|
-
'node_modules/',
|
|
23
|
-
'build/',
|
|
24
|
-
'cjs/',
|
|
25
|
-
'coverage/',
|
|
26
|
-
'dist/',
|
|
27
|
-
'dts/',
|
|
28
|
-
'esm/',
|
|
29
|
-
'lib/',
|
|
30
|
-
'mjs/',
|
|
31
|
-
'umd/',
|
|
32
|
-
];
|
|
33
|
-
/**
|
|
34
|
-
* Supported file extensions
|
|
35
|
-
*
|
|
36
|
-
* @example
|
|
37
|
-
* ```ts
|
|
38
|
-
* EXTENSIONS // ['.ts', '.js', ...]
|
|
39
|
-
* ```
|
|
40
|
-
*/
|
|
41
|
-
exports.EXTENSIONS = ['.ts', '.tsx', '.cts', '.mts', '.js', '.jsx', '.cjs', '.mjs'];
|
|
42
|
-
/**
|
|
43
|
-
* Supported file extensions without starting dots
|
|
44
|
-
*
|
|
45
|
-
* @example
|
|
46
|
-
* ```ts
|
|
47
|
-
* EXTENSIONS_WITHOUT_DOT // ['ts', 'js', ...]
|
|
48
|
-
* ```
|
|
49
|
-
*/
|
|
50
|
-
exports.EXTENSIONS_WITHOUT_DOT = exports.EXTENSIONS.map((ext) => ext.slice(1));
|
|
51
|
-
/**
|
|
52
|
-
* List of globs to find config related files
|
|
53
|
-
*
|
|
54
|
-
* @example
|
|
55
|
-
* ```ts
|
|
56
|
-
* CONFIG_GLOB_LIST // ['**\/.*.{js,cjs}', '**\/*.config.{js,cjs}']
|
|
57
|
-
* ```
|
|
58
|
-
*/
|
|
59
|
-
exports.CONFIG_GLOB_LIST = ['**/.*.{js,cjs}', '**/*.config.{js,cjs}'];
|
|
60
|
-
exports.EXTENSIONS_RESOURCES_REGEX = '\\.(css|sass|scss|less|gif|png|jpg|jpeg|svg|gql|graphql|yml|yaml)$';
|
|
17
|
+
__exportStar(require("./constant.js"), exports);
|
|
18
|
+
__exportStar(require("./eslint.js"), exports);
|
|
61
19
|
//# sourceMappingURL=index.js.map
|
package/lib/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,gDAA8B;AAC9B,8CAA4B"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@w5s/dev",
|
|
3
|
-
"version": "1.0.0-alpha.
|
|
3
|
+
"version": "1.0.0-alpha.4",
|
|
4
4
|
"description": "Shared development constants and functions",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"config",
|
|
@@ -47,7 +47,27 @@
|
|
|
47
47
|
"prepublishOnly": "npm run clean;npm run build",
|
|
48
48
|
"spellcheck": "cspell --no-progress '**'",
|
|
49
49
|
"test": "concurrently \"npm:test:*\" ",
|
|
50
|
-
"test:src": "
|
|
50
|
+
"test:src": "jest"
|
|
51
|
+
},
|
|
52
|
+
"jest": {
|
|
53
|
+
"moduleNameMapper": {
|
|
54
|
+
"^(\\.{1,2}/.*)\\.js$": "$1"
|
|
55
|
+
},
|
|
56
|
+
"preset": "es-jest",
|
|
57
|
+
"testPathIgnorePatterns": [
|
|
58
|
+
"/node_modules/",
|
|
59
|
+
"/lib/",
|
|
60
|
+
"/build/",
|
|
61
|
+
"/.cache/",
|
|
62
|
+
"/docs/",
|
|
63
|
+
"/public/"
|
|
64
|
+
]
|
|
65
|
+
},
|
|
66
|
+
"dependencies": {
|
|
67
|
+
"@types/eslint": "^8.4.10"
|
|
68
|
+
},
|
|
69
|
+
"devDependencies": {
|
|
70
|
+
"@jest/globals": "29.4.1"
|
|
51
71
|
},
|
|
52
72
|
"engines": {
|
|
53
73
|
"node": ">=16.0.0"
|
|
@@ -55,5 +75,5 @@
|
|
|
55
75
|
"publishConfig": {
|
|
56
76
|
"access": "public"
|
|
57
77
|
},
|
|
58
|
-
"gitHead": "
|
|
78
|
+
"gitHead": "dd093c2907cf8e136f4adec9a14b176e0851de17"
|
|
59
79
|
}
|
package/src/constant.ts
ADDED
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Supported ECMA version
|
|
3
|
+
*
|
|
4
|
+
* @example
|
|
5
|
+
* ```ts
|
|
6
|
+
* ECMA_VERSION // 2022
|
|
7
|
+
* ```
|
|
8
|
+
*/
|
|
9
|
+
export const ECMA_VERSION = 2022;
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* Files and folders to always ignore
|
|
13
|
+
*
|
|
14
|
+
* @example
|
|
15
|
+
* ```ts
|
|
16
|
+
* IGNORE_LIST // ['node_modules/', 'build/', ...]
|
|
17
|
+
* ```
|
|
18
|
+
*/
|
|
19
|
+
export const IGNORE_LIST = [
|
|
20
|
+
'node_modules/',
|
|
21
|
+
'build/',
|
|
22
|
+
'cjs/',
|
|
23
|
+
'coverage/',
|
|
24
|
+
'dist/',
|
|
25
|
+
'dts/',
|
|
26
|
+
'esm/',
|
|
27
|
+
'lib/',
|
|
28
|
+
'mjs/',
|
|
29
|
+
'umd/',
|
|
30
|
+
];
|
|
31
|
+
|
|
32
|
+
/**
|
|
33
|
+
* Supported file extensions
|
|
34
|
+
*
|
|
35
|
+
* @example
|
|
36
|
+
* ```ts
|
|
37
|
+
* EXTENSIONS // ['.ts', '.js', ...]
|
|
38
|
+
* ```
|
|
39
|
+
*/
|
|
40
|
+
export const EXTENSIONS = ['.ts', '.tsx', '.cts', '.mts', '.js', '.jsx', '.cjs', '.mjs'];
|
|
41
|
+
|
|
42
|
+
/**
|
|
43
|
+
* Supported file extensions without starting dots
|
|
44
|
+
*
|
|
45
|
+
* @example
|
|
46
|
+
* ```ts
|
|
47
|
+
* EXTENSIONS_WITHOUT_DOT // ['ts', 'js', ...]
|
|
48
|
+
* ```
|
|
49
|
+
*/
|
|
50
|
+
export const EXTENSIONS_WITHOUT_DOT = EXTENSIONS.map((ext) => ext.slice(1));
|
|
51
|
+
|
|
52
|
+
/**
|
|
53
|
+
* List of globs to find config related files
|
|
54
|
+
*
|
|
55
|
+
* @example
|
|
56
|
+
* ```ts
|
|
57
|
+
* CONFIG_GLOB_LIST // ['**\/.*.{js,cjs}', '**\/*.config.{js,cjs}']
|
|
58
|
+
* ```
|
|
59
|
+
*/
|
|
60
|
+
export const CONFIG_GLOB_LIST = ['**/.*.{js,cjs}', '**/*.config.{js,cjs}'];
|
|
61
|
+
|
|
62
|
+
export const EXTENSIONS_RESOURCES_REGEX = '\\.(css|sass|scss|less|gif|png|jpg|jpeg|svg|gql|graphql|yml|yaml)$';
|
package/src/eslint.ts
ADDED
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import type { ESLint } from 'eslint';
|
|
2
|
+
|
|
3
|
+
function toArray<T>(value: T[] | T | undefined): T[] {
|
|
4
|
+
if (value == null) {
|
|
5
|
+
return [];
|
|
6
|
+
}
|
|
7
|
+
if (Array.isArray(value)) {
|
|
8
|
+
return value;
|
|
9
|
+
}
|
|
10
|
+
return [value];
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
function concatArray<T>(left: T[] | T | undefined, right: T[] | T | undefined): T[] {
|
|
14
|
+
return toArray(left).concat(toArray(right));
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
export namespace ESLintConfig {
|
|
18
|
+
/**
|
|
19
|
+
*
|
|
20
|
+
* @param configs
|
|
21
|
+
*/
|
|
22
|
+
export function concat(...configs: ESLint.ConfigData[]): ESLint.ConfigData {
|
|
23
|
+
return configs.reduce(
|
|
24
|
+
(returnValue, config) => ({
|
|
25
|
+
...returnValue,
|
|
26
|
+
...config,
|
|
27
|
+
env: { ...returnValue.env, ...config.env },
|
|
28
|
+
extends: concatArray(returnValue.extends, config.extends),
|
|
29
|
+
globals: { ...returnValue.globals, ...config.globals },
|
|
30
|
+
overrides: concatArray(returnValue.overrides, config.overrides),
|
|
31
|
+
parserOptions: { ...returnValue.parserOptions, ...config.parserOptions },
|
|
32
|
+
plugins: concatArray(returnValue.plugins, config.plugins),
|
|
33
|
+
rules: { ...returnValue.rules, ...config.rules },
|
|
34
|
+
settings: { ...returnValue.settings, ...config.settings },
|
|
35
|
+
}),
|
|
36
|
+
{
|
|
37
|
+
env: {},
|
|
38
|
+
extends: [],
|
|
39
|
+
globals: {},
|
|
40
|
+
overrides: [],
|
|
41
|
+
parserOptions: {},
|
|
42
|
+
plugins: [],
|
|
43
|
+
rules: {},
|
|
44
|
+
settings: {},
|
|
45
|
+
}
|
|
46
|
+
);
|
|
47
|
+
}
|
|
48
|
+
}
|
package/src/index.ts
CHANGED
|
@@ -1,62 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
*
|
|
3
|
-
*
|
|
4
|
-
* @example
|
|
5
|
-
* ```ts
|
|
6
|
-
* ECMA_VERSION // 2022
|
|
7
|
-
* ```
|
|
8
|
-
*/
|
|
9
|
-
export const ECMA_VERSION = 2022;
|
|
10
|
-
|
|
11
|
-
/**
|
|
12
|
-
* Files and folders to always ignore
|
|
13
|
-
*
|
|
14
|
-
* @example
|
|
15
|
-
* ```ts
|
|
16
|
-
* IGNORE_LIST // ['node_modules/', 'build/', ...]
|
|
17
|
-
* ```
|
|
18
|
-
*/
|
|
19
|
-
export const IGNORE_LIST = [
|
|
20
|
-
'node_modules/',
|
|
21
|
-
'build/',
|
|
22
|
-
'cjs/',
|
|
23
|
-
'coverage/',
|
|
24
|
-
'dist/',
|
|
25
|
-
'dts/',
|
|
26
|
-
'esm/',
|
|
27
|
-
'lib/',
|
|
28
|
-
'mjs/',
|
|
29
|
-
'umd/',
|
|
30
|
-
];
|
|
31
|
-
|
|
32
|
-
/**
|
|
33
|
-
* Supported file extensions
|
|
34
|
-
*
|
|
35
|
-
* @example
|
|
36
|
-
* ```ts
|
|
37
|
-
* EXTENSIONS // ['.ts', '.js', ...]
|
|
38
|
-
* ```
|
|
39
|
-
*/
|
|
40
|
-
export const EXTENSIONS = ['.ts', '.tsx', '.cts', '.mts', '.js', '.jsx', '.cjs', '.mjs'];
|
|
41
|
-
|
|
42
|
-
/**
|
|
43
|
-
* Supported file extensions without starting dots
|
|
44
|
-
*
|
|
45
|
-
* @example
|
|
46
|
-
* ```ts
|
|
47
|
-
* EXTENSIONS_WITHOUT_DOT // ['ts', 'js', ...]
|
|
48
|
-
* ```
|
|
49
|
-
*/
|
|
50
|
-
export const EXTENSIONS_WITHOUT_DOT = EXTENSIONS.map((ext) => ext.slice(1));
|
|
51
|
-
|
|
52
|
-
/**
|
|
53
|
-
* List of globs to find config related files
|
|
54
|
-
*
|
|
55
|
-
* @example
|
|
56
|
-
* ```ts
|
|
57
|
-
* CONFIG_GLOB_LIST // ['**\/.*.{js,cjs}', '**\/*.config.{js,cjs}']
|
|
58
|
-
* ```
|
|
59
|
-
*/
|
|
60
|
-
export const CONFIG_GLOB_LIST = ['**/.*.{js,cjs}', '**/*.config.{js,cjs}'];
|
|
61
|
-
|
|
62
|
-
export const EXTENSIONS_RESOURCES_REGEX = '\\.(css|sass|scss|less|gif|png|jpg|jpeg|svg|gql|graphql|yml|yaml)$';
|
|
1
|
+
export * from './constant.js';
|
|
2
|
+
export * from './eslint.js';
|