@camaro/eslint-config 2.0.2 → 3.1.1
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/index.d.ts +4 -0
- package/lib/index.js +31 -0
- package/package.json +12 -15
- package/src/common.js +0 -38
- package/src/typescript.js +0 -22
package/lib/index.d.ts
ADDED
package/lib/index.js
ADDED
@@ -0,0 +1,31 @@
|
|
1
|
+
import stylistic from "@stylistic/eslint-plugin";
|
2
|
+
import eslintJS from "@eslint/js";
|
3
|
+
import eslintTS from "typescript-eslint";
|
4
|
+
const styleLint = stylistic.configs.customize({
|
5
|
+
indent: 4,
|
6
|
+
jsx: false,
|
7
|
+
quotes: "double",
|
8
|
+
semi: true,
|
9
|
+
});
|
10
|
+
export const common = [
|
11
|
+
eslintJS.configs.recommended,
|
12
|
+
styleLint,
|
13
|
+
{ rules: { "@stylistic/max-len": ["error", { code: 120 }] } },
|
14
|
+
];
|
15
|
+
const eslintTsRules = [
|
16
|
+
...eslintTS.configs.recommendedTypeChecked,
|
17
|
+
...eslintTS.configs.strictTypeChecked,
|
18
|
+
...eslintTS.configs.stylisticTypeChecked,
|
19
|
+
].reduce((acc, config) => ({ ...acc, ...config.rules }), {});
|
20
|
+
export const ts = [
|
21
|
+
...common,
|
22
|
+
{
|
23
|
+
files: ["**/*.ts"],
|
24
|
+
languageOptions: {
|
25
|
+
parser: eslintTS.parser,
|
26
|
+
parserOptions: { projectService: true },
|
27
|
+
},
|
28
|
+
plugins: { "@typescript-eslint": eslintTS.plugin },
|
29
|
+
rules: { ...eslintTsRules },
|
30
|
+
},
|
31
|
+
];
|
package/package.json
CHANGED
@@ -1,25 +1,17 @@
|
|
1
1
|
{
|
2
2
|
"name": "@camaro/eslint-config",
|
3
|
-
"version": "
|
3
|
+
"version": "3.1.1",
|
4
4
|
"description": "A shareable eslint config.",
|
5
|
-
"
|
6
|
-
".": {
|
7
|
-
"default": "./src/common.js",
|
8
|
-
"types": "./type.d.ts"
|
9
|
-
},
|
10
|
-
"./ts": {
|
11
|
-
"default": "./src/typescript.js",
|
12
|
-
"types": "./type.d.ts"
|
13
|
-
}
|
14
|
-
},
|
5
|
+
"main": "lib/index.js",
|
15
6
|
"scripts": {
|
16
|
-
"build": "",
|
17
|
-
"prepare": "husky || true",
|
7
|
+
"build": "tsc -b",
|
18
8
|
"cspell": "cspell --config ./eng/cspell.config.json --quiet .",
|
19
9
|
"commitlint": "commitlint --config ./eng/.commitlintrc.json --edit",
|
20
10
|
"eslint": "eslint --config ./eng/eslint.config.js .",
|
21
11
|
"lint": "npm run cspell && npm run eslint",
|
22
|
-
"lint:staged": "lint-staged --config ./eng/.lintstagedrc.json"
|
12
|
+
"lint:staged": "lint-staged --config ./eng/.lintstagedrc.json",
|
13
|
+
"prepare": "husky || true",
|
14
|
+
"test": "TSX_TSCONFIG_PATH=./test/tsconfig.json tsx ./test/index.ts"
|
23
15
|
},
|
24
16
|
"repository": {
|
25
17
|
"type": "git",
|
@@ -40,14 +32,19 @@
|
|
40
32
|
"@stylistic/eslint-plugin": "^4.2.0"
|
41
33
|
},
|
42
34
|
"devDependencies": {
|
35
|
+
"@camaro/eslint-config": "^2.0.2",
|
36
|
+
"@camaro/tsconfig": "^1.1.1",
|
43
37
|
"@commitlint/cli": "^19.8.0",
|
44
38
|
"@commitlint/config-conventional": "^19.8.0",
|
39
|
+
"@types/node": "^22.15.18",
|
45
40
|
"cspell": "^8.18.1",
|
46
41
|
"eslint": "^9.24.0",
|
47
42
|
"globals": "^16.0.0",
|
48
43
|
"husky": "^9.1.7",
|
49
44
|
"lint-staged": "^15.5.1",
|
50
|
-
"
|
45
|
+
"tsx": "^4.19.4",
|
46
|
+
"typescript": "^5.8.3",
|
47
|
+
"typescript-eslint": "^8.32.1"
|
51
48
|
},
|
52
49
|
"peerDependencies": {
|
53
50
|
"eslint": ">=9.0.0",
|
package/src/common.js
DELETED
@@ -1,38 +0,0 @@
|
|
1
|
-
const stylistic = require("@stylistic/eslint-plugin");
|
2
|
-
const eslint = require("@eslint/js");
|
3
|
-
|
4
|
-
const customized = stylistic.configs.customize({
|
5
|
-
indent: 4,
|
6
|
-
jsx: false,
|
7
|
-
quotes: "double",
|
8
|
-
semi: true,
|
9
|
-
});
|
10
|
-
|
11
|
-
/** @type {import('eslint').Linter.Config[]} */
|
12
|
-
module.exports = [
|
13
|
-
eslint.configs.recommended,
|
14
|
-
customized,
|
15
|
-
{
|
16
|
-
rules: {
|
17
|
-
// #region stylistic rules
|
18
|
-
"@stylistic/array-bracket-newline": ["error", { multiline: true }],
|
19
|
-
"@stylistic/array-element-newline": ["error", { consistent: true }],
|
20
|
-
"@stylistic/function-call-argument-newline": ["error", "consistent"],
|
21
|
-
"@stylistic/function-paren-newline": ["error", "multiline"],
|
22
|
-
"@stylistic/max-len": [
|
23
|
-
"error", {
|
24
|
-
code: 120,
|
25
|
-
ignoreComments: true,
|
26
|
-
ignoreRegExpLiterals: true,
|
27
|
-
ignoreStrings: true,
|
28
|
-
ignoreTemplateLiterals: true,
|
29
|
-
ignoreTrailingComments: true,
|
30
|
-
ignoreUrls: true,
|
31
|
-
},
|
32
|
-
],
|
33
|
-
"@stylistic/object-curly-newline": ["error", { multiline: true }],
|
34
|
-
"@stylistic/object-property-newline": ["error", { allowAllPropertiesOnSameLine: true }],
|
35
|
-
// #endregion
|
36
|
-
},
|
37
|
-
},
|
38
|
-
];
|
package/src/typescript.js
DELETED
@@ -1,22 +0,0 @@
|
|
1
|
-
const tsEslint = require("typescript-eslint");
|
2
|
-
const common = require("./common");
|
3
|
-
|
4
|
-
const typescriptRules = [
|
5
|
-
...tsEslint.configs.recommendedTypeChecked,
|
6
|
-
...tsEslint.configs.strictTypeChecked,
|
7
|
-
...tsEslint.configs.stylisticTypeChecked,
|
8
|
-
].reduce((acc, config) => ({ ...acc, ...config.rules }), {});
|
9
|
-
|
10
|
-
/** @type {import('eslint').Linter.Config[]} */
|
11
|
-
module.exports = [
|
12
|
-
...common,
|
13
|
-
{
|
14
|
-
files: ["**/*.ts"],
|
15
|
-
languageOptions: {
|
16
|
-
parser: tsEslint.parser,
|
17
|
-
parserOptions: { projectService: true },
|
18
|
-
},
|
19
|
-
plugins: { "@typescript-eslint": tsEslint.plugin },
|
20
|
-
rules: { ...typescriptRules },
|
21
|
-
},
|
22
|
-
];
|