@nik3iw/eslint-config 0.1.0 → 1.0.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/LICENSE +21 -21
- package/README.md +7 -7
- package/dist/index.d.mts +18 -0
- package/dist/index.d.mts.map +1 -0
- package/dist/index.mjs +106 -0
- package/dist/index.mjs.map +1 -0
- package/package.json +4 -4
package/LICENSE
CHANGED
|
@@ -1,21 +1,21 @@
|
|
|
1
|
-
MIT License
|
|
2
|
-
|
|
3
|
-
Copyright (c) 2026 Nik
|
|
4
|
-
|
|
5
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
-
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
-
in the Software without restriction, including without limitation the rights
|
|
8
|
-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
-
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
-
furnished to do so, subject to the following conditions:
|
|
11
|
-
|
|
12
|
-
The above copyright notice and this permission notice shall be included in all
|
|
13
|
-
copies or substantial portions of the Software.
|
|
14
|
-
|
|
15
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
-
SOFTWARE.
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Nik
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
[](https://www.npmjs.com/package/@nik3iw/eslint-config)
|
|
2
|
-
[](https://www.npmjs.com/package/@nik3iw/eslint-config)
|
|
3
|
-
[](https://github.com/Nik3iw/eslint-config/actions/workflows/release.yml)
|
|
4
|
-
[](https://github.com/semantic-release/semantic-release)
|
|
5
|
-
|
|
6
|
-
# eslint-config
|
|
7
|
-
Shareable ESLint Config
|
|
1
|
+
[](https://www.npmjs.com/package/@nik3iw/eslint-config)
|
|
2
|
+
[](https://www.npmjs.com/package/@nik3iw/eslint-config)
|
|
3
|
+
[](https://github.com/Nik3iw/eslint-config/actions/workflows/release.yml)
|
|
4
|
+
[](https://github.com/semantic-release/semantic-release)
|
|
5
|
+
|
|
6
|
+
# eslint-config
|
|
7
|
+
Shareable ESLint Config
|
package/dist/index.d.mts
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { ConfigWithExtends } from "typescript-eslint";
|
|
2
|
+
|
|
3
|
+
//#region src/index.d.ts
|
|
4
|
+
type Platform = "web" | "node";
|
|
5
|
+
interface Params {
|
|
6
|
+
platform: Platform;
|
|
7
|
+
configs?: {
|
|
8
|
+
typescript?: boolean | {
|
|
9
|
+
tsconfigRootDir?: string;
|
|
10
|
+
};
|
|
11
|
+
unicorn?: boolean;
|
|
12
|
+
};
|
|
13
|
+
extends?: ConfigWithExtends[];
|
|
14
|
+
}
|
|
15
|
+
declare function createConfig(params: Params): ConfigWithExtends[];
|
|
16
|
+
//#endregion
|
|
17
|
+
export { createConfig };
|
|
18
|
+
//# sourceMappingURL=index.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.mts","names":[],"sources":["../src/index.ts"],"mappings":";;;KAOK,QAAA;AAAA,UAEK,MAAA;EACR,QAAA,EAAU,QAAA;EACV,OAAA;IACE,UAAA;MAAyB,eAAA;IAAA;IACzB,OAAA;EAAA;EAEF,OAAA,GAAU,iBAAiB;AAAA;AAAA,iBAGb,YAAA,CAAa,MAAA,EAAQ,MAAA,GAAS,iBAAiB"}
|
package/dist/index.mjs
ADDED
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
import globals from "globals";
|
|
2
|
+
import { defineConfig } from "eslint/config";
|
|
3
|
+
import js from "@eslint/js";
|
|
4
|
+
import tsEslint from "typescript-eslint";
|
|
5
|
+
import eslintPluginUnicorn from "eslint-plugin-unicorn";
|
|
6
|
+
import eslintConfigPrettier from "eslint-config-prettier/flat";
|
|
7
|
+
//#region src/configs/javascript.ts
|
|
8
|
+
function javascriptConfig() {
|
|
9
|
+
return defineConfig({
|
|
10
|
+
files: ["**/*.{js,mjs,cjs,ts,mts,cts,jsx,tsx}"],
|
|
11
|
+
plugins: { js },
|
|
12
|
+
extends: ["js/recommended"]
|
|
13
|
+
}, {
|
|
14
|
+
files: ["**/*.{js,mjs,cjs,ts,mts,cts,jsx,tsx}"],
|
|
15
|
+
rules: {
|
|
16
|
+
"array-callback-return": ["error"],
|
|
17
|
+
curly: ["warn", "all"],
|
|
18
|
+
eqeqeq: ["warn"],
|
|
19
|
+
"no-unused-vars": ["error", {
|
|
20
|
+
vars: "all",
|
|
21
|
+
args: "all",
|
|
22
|
+
argsIgnorePattern: "^_",
|
|
23
|
+
caughtErrors: "all",
|
|
24
|
+
caughtErrorsIgnorePattern: "^ignore",
|
|
25
|
+
destructuredArrayIgnorePattern: "^_",
|
|
26
|
+
ignoreRestSiblings: false,
|
|
27
|
+
ignoreClassWithStaticInitBlock: false,
|
|
28
|
+
ignoreUsingDeclarations: false,
|
|
29
|
+
reportUsedIgnorePattern: false
|
|
30
|
+
}]
|
|
31
|
+
}
|
|
32
|
+
});
|
|
33
|
+
}
|
|
34
|
+
//#endregion
|
|
35
|
+
//#region src/configs/typescript.ts
|
|
36
|
+
function typescriptConfig(params) {
|
|
37
|
+
return defineConfig(tsEslint.configs.strictTypeChecked, tsEslint.configs.stylisticTypeChecked, { languageOptions: { parserOptions: {
|
|
38
|
+
projectService: true,
|
|
39
|
+
...params.tsconfigRootDir !== void 0 ? { tsconfigRootDir: params.tsconfigRootDir } : {}
|
|
40
|
+
} } }, {
|
|
41
|
+
files: ["**/*.{js,mjs,cjs,ts,mts,cts,jsx,tsx}"],
|
|
42
|
+
rules: {
|
|
43
|
+
"@typescript-eslint/prefer-optional-chain": ["off"],
|
|
44
|
+
"@typescript-eslint/prefer-nullish-coalescing": ["off"],
|
|
45
|
+
"no-unused-vars": ["off"],
|
|
46
|
+
"@typescript-eslint/no-unused-vars": ["error", {
|
|
47
|
+
vars: "all",
|
|
48
|
+
args: "all",
|
|
49
|
+
argsIgnorePattern: "^_",
|
|
50
|
+
caughtErrors: "all",
|
|
51
|
+
caughtErrorsIgnorePattern: "^ignore",
|
|
52
|
+
destructuredArrayIgnorePattern: "^_",
|
|
53
|
+
ignoreRestSiblings: false,
|
|
54
|
+
ignoreClassWithStaticInitBlock: false,
|
|
55
|
+
ignoreUsingDeclarations: false,
|
|
56
|
+
reportUsedIgnorePattern: false
|
|
57
|
+
}]
|
|
58
|
+
}
|
|
59
|
+
});
|
|
60
|
+
}
|
|
61
|
+
//#endregion
|
|
62
|
+
//#region src/configs/unicorn.ts
|
|
63
|
+
function unicornConfig() {
|
|
64
|
+
return defineConfig(eslintPluginUnicorn.configs.recommended, {
|
|
65
|
+
files: ["**/*.{js,mjs,cjs,ts,mts,cts,jsx,tsx}"],
|
|
66
|
+
rules: {
|
|
67
|
+
"unicorn/filename-case": ["off"],
|
|
68
|
+
"unicorn/no-null": ["off"],
|
|
69
|
+
"unicorn/prevent-abbreviations": ["off"]
|
|
70
|
+
}
|
|
71
|
+
});
|
|
72
|
+
}
|
|
73
|
+
//#endregion
|
|
74
|
+
//#region src/configs/prettier.ts
|
|
75
|
+
function prettierConfig() {
|
|
76
|
+
return defineConfig(eslintConfigPrettier);
|
|
77
|
+
}
|
|
78
|
+
//#endregion
|
|
79
|
+
//#region src/index.ts
|
|
80
|
+
function createConfig(params) {
|
|
81
|
+
const configs = {
|
|
82
|
+
typescript: true,
|
|
83
|
+
unicorn: true,
|
|
84
|
+
...params.configs
|
|
85
|
+
};
|
|
86
|
+
const final = [...javascriptConfig()];
|
|
87
|
+
if (configs.typescript !== false) final.push(...typescriptConfig(typeof configs.typescript !== "boolean" ? configs.typescript : {}));
|
|
88
|
+
if (configs.unicorn) final.push(...unicornConfig());
|
|
89
|
+
final.push(...prettierConfig());
|
|
90
|
+
if (params.extends !== void 0) final.push(...params.extends);
|
|
91
|
+
final.push({
|
|
92
|
+
files: ["**/*.{js,mjs,cjs,ts,mts,cts,jsx,tsx}"],
|
|
93
|
+
languageOptions: {
|
|
94
|
+
ecmaVersion: params.platform === "web" ? 2023 : 2025,
|
|
95
|
+
globals: params.platform === "web" ? {
|
|
96
|
+
...globals.serviceworker,
|
|
97
|
+
...globals.browser
|
|
98
|
+
} : globals.node
|
|
99
|
+
}
|
|
100
|
+
});
|
|
101
|
+
return final;
|
|
102
|
+
}
|
|
103
|
+
//#endregion
|
|
104
|
+
export { createConfig };
|
|
105
|
+
|
|
106
|
+
//# sourceMappingURL=index.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.mjs","names":[],"sources":["../src/configs/javascript.ts","../src/configs/typescript.ts","../src/configs/unicorn.ts","../src/configs/prettier.ts","../src/index.ts"],"sourcesContent":["import type { Config } from \"eslint/config\";\nimport { defineConfig } from \"eslint/config\";\nimport js from \"@eslint/js\";\n\nexport function javascriptConfig(): Config[] {\n return defineConfig(\n {\n files: [\"**/*.{js,mjs,cjs,ts,mts,cts,jsx,tsx}\"],\n plugins: { js },\n extends: [\"js/recommended\"],\n },\n\n // Rules\n {\n files: [\"**/*.{js,mjs,cjs,ts,mts,cts,jsx,tsx}\"],\n rules: {\n \"array-callback-return\": [\"error\"],\n curly: [\"warn\", \"all\"],\n eqeqeq: [\"warn\"],\n \"no-unused-vars\": [\n \"error\",\n {\n vars: \"all\",\n args: \"all\",\n argsIgnorePattern: \"^_\",\n caughtErrors: \"all\",\n caughtErrorsIgnorePattern: \"^ignore\",\n destructuredArrayIgnorePattern: \"^_\",\n ignoreRestSiblings: false,\n ignoreClassWithStaticInitBlock: false,\n ignoreUsingDeclarations: false,\n reportUsedIgnorePattern: false,\n },\n ],\n },\n },\n );\n}\n","import type { Config } from \"eslint/config\";\nimport { defineConfig } from \"eslint/config\";\nimport tsEslint from \"typescript-eslint\";\nimport type { ConfigWithExtends } from \"typescript-eslint\";\n\ninterface Params {\n tsconfigRootDir?: string;\n}\n\nexport function typescriptConfig(params: Params): Config[] {\n return defineConfig(\n tsEslint.configs.strictTypeChecked,\n tsEslint.configs.stylisticTypeChecked,\n\n {\n languageOptions: {\n parserOptions: {\n projectService: true,\n ...(params.tsconfigRootDir !== undefined\n ? { tsconfigRootDir: params.tsconfigRootDir }\n : {}),\n },\n } satisfies ConfigWithExtends[\"languageOptions\"],\n },\n\n // Rules\n {\n files: [\"**/*.{js,mjs,cjs,ts,mts,cts,jsx,tsx}\"],\n rules: {\n \"@typescript-eslint/prefer-optional-chain\": [\"off\"],\n \"@typescript-eslint/prefer-nullish-coalescing\": [\"off\"],\n\n \"no-unused-vars\": [\"off\"],\n \"@typescript-eslint/no-unused-vars\": [\n \"error\",\n {\n vars: \"all\",\n args: \"all\",\n argsIgnorePattern: \"^_\",\n caughtErrors: \"all\",\n caughtErrorsIgnorePattern: \"^ignore\",\n destructuredArrayIgnorePattern: \"^_\",\n ignoreRestSiblings: false,\n ignoreClassWithStaticInitBlock: false,\n ignoreUsingDeclarations: false,\n reportUsedIgnorePattern: false,\n },\n ],\n },\n },\n );\n}\n","import type { Config } from \"eslint/config\";\nimport { defineConfig } from \"eslint/config\";\nimport eslintPluginUnicorn from \"eslint-plugin-unicorn\";\n\nexport function unicornConfig(): Config[] {\n return defineConfig(\n eslintPluginUnicorn.configs.recommended,\n\n // Rules\n {\n files: [\"**/*.{js,mjs,cjs,ts,mts,cts,jsx,tsx}\"],\n rules: {\n \"unicorn/filename-case\": [\"off\"],\n \"unicorn/no-null\": [\"off\"],\n \"unicorn/prevent-abbreviations\": [\"off\"],\n },\n },\n );\n}\n","import type { Config } from \"eslint/config\";\nimport { defineConfig } from \"eslint/config\";\nimport eslintConfigPrettier from \"eslint-config-prettier/flat\";\n\nexport function prettierConfig(): Config[] {\n return defineConfig(eslintConfigPrettier);\n}\n","import type { ConfigWithExtends } from \"typescript-eslint\";\nimport globals from \"globals\";\nimport { javascriptConfig } from \"./configs/javascript\";\nimport { typescriptConfig } from \"./configs/typescript\";\nimport { unicornConfig } from \"./configs/unicorn\";\nimport { prettierConfig } from \"./configs/prettier\";\n\ntype Platform = \"web\" | \"node\";\n\ninterface Params {\n platform: Platform;\n configs?: {\n typescript?: boolean | { tsconfigRootDir?: string };\n unicorn?: boolean;\n };\n extends?: ConfigWithExtends[];\n}\n\nexport function createConfig(params: Params): ConfigWithExtends[] {\n const configs: Required<Params[\"configs\"]> = {\n typescript: true,\n unicorn: true,\n ...params.configs,\n };\n\n const final: ConfigWithExtends[] = [...javascriptConfig()];\n\n // Typescript\n if (configs.typescript !== false) {\n final.push(\n ...typescriptConfig(typeof configs.typescript !== \"boolean\" ? configs.typescript : {}),\n );\n }\n\n // Unicorn\n if (configs.unicorn) {\n final.push(...unicornConfig());\n }\n\n // Prettier\n final.push(...prettierConfig());\n\n if (params.extends !== undefined) {\n final.push(...params.extends);\n }\n\n final.push({\n files: [\"**/*.{js,mjs,cjs,ts,mts,cts,jsx,tsx}\"],\n languageOptions: {\n ecmaVersion: params.platform === \"web\" ? 2023 : 2025,\n globals:\n params.platform === \"web\"\n ? {\n ...globals.serviceworker,\n ...globals.browser,\n }\n : globals.node,\n },\n });\n\n return final;\n}\n"],"mappings":";;;;;;;AAIA,SAAgB,mBAA6B;CAC3C,OAAO,aACL;EACE,OAAO,CAAC,sCAAsC;EAC9C,SAAS,EAAE,GAAG;EACd,SAAS,CAAC,gBAAgB;CAC5B,GAGA;EACE,OAAO,CAAC,sCAAsC;EAC9C,OAAO;GACL,yBAAyB,CAAC,OAAO;GACjC,OAAO,CAAC,QAAQ,KAAK;GACrB,QAAQ,CAAC,MAAM;GACf,kBAAkB,CAChB,SACA;IACE,MAAM;IACN,MAAM;IACN,mBAAmB;IACnB,cAAc;IACd,2BAA2B;IAC3B,gCAAgC;IAChC,oBAAoB;IACpB,gCAAgC;IAChC,yBAAyB;IACzB,yBAAyB;GAC3B,CACF;EACF;CACF,CACF;AACF;;;AC5BA,SAAgB,iBAAiB,QAA0B;CACzD,OAAO,aACL,SAAS,QAAQ,mBACjB,SAAS,QAAQ,sBAEjB,EACE,iBAAiB,EACf,eAAe;EACb,gBAAgB;EAChB,GAAI,OAAO,oBAAoB,KAA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Q;EAChB;CACF,CAAC;CAED,OAAO;AACT"}
|
package/package.json
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nik3iw/eslint-config",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "1.0.0",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"publishConfig": {
|
|
7
7
|
"access": "public",
|
|
8
|
-
"provenance":
|
|
8
|
+
"provenance": true
|
|
9
9
|
},
|
|
10
10
|
"author": "Nik3iw",
|
|
11
11
|
"description": "Shareable ESLint Config",
|
|
@@ -33,7 +33,7 @@
|
|
|
33
33
|
}
|
|
34
34
|
},
|
|
35
35
|
"scripts": {
|
|
36
|
-
"build": "
|
|
36
|
+
"build": "tsdown",
|
|
37
37
|
"release": "semantic-release",
|
|
38
38
|
"release:dry": "semantic-release --dry-run"
|
|
39
39
|
},
|
|
@@ -61,7 +61,7 @@
|
|
|
61
61
|
"eslint": "^10.4.1",
|
|
62
62
|
"prettier": "^3.8.3",
|
|
63
63
|
"semantic-release": "^25.0.3",
|
|
64
|
-
"
|
|
64
|
+
"tsdown": "^0.22.1",
|
|
65
65
|
"typescript": "~6.0.3"
|
|
66
66
|
},
|
|
67
67
|
"packageManager": "yarn@4.16.0"
|