@camaro/eslint-config 0.1.2 → 0.1.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/CHANGELOG.md +14 -0
- package/README.md +95 -0
- package/lib/common.d.ts +1 -2
- package/lib/common.js +13 -16
- package/lib/typescript.d.ts +2 -2
- package/lib/typescript.js +25 -13
- package/package.json +11 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,19 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## [0.1.4](https://github.com/camarojs/camaro/compare/eslint-config-v0.1.3...eslint-config-v0.1.4) (2026-02-09)
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
### Features
|
|
7
|
+
|
|
8
|
+
* **eslint-config:** add additional rules for template expression restrictions in TypeScript config ([#40](https://github.com/camarojs/camaro/issues/40)) ([0a2565d](https://github.com/camarojs/camaro/commit/0a2565d0cfd0e2fa3b968c552ba18a30865dd7bb))
|
|
9
|
+
|
|
10
|
+
## [0.1.3](https://github.com/camarojs/camaro/compare/eslint-config-v0.1.2...eslint-config-v0.1.3) (2026-02-09)
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
### Features
|
|
14
|
+
|
|
15
|
+
* **eslint-config:** update common and typescript lint configurations to use defineConfig ([#36](https://github.com/camarojs/camaro/issues/36)) ([11719df](https://github.com/camarojs/camaro/commit/11719df051cade69427c6ddfdad79e0558bcf372))
|
|
16
|
+
|
|
3
17
|
## [0.1.2](https://github.com/camarojs/camaro/compare/eslint-config-v0.1.1...eslint-config-v0.1.2) (2026-01-30)
|
|
4
18
|
|
|
5
19
|
|
package/README.md
ADDED
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
# @camaro/eslint-config
|
|
2
|
+
|
|
3
|
+
A shareable ESLint configuration preset for modern JavaScript and TypeScript projects.
|
|
4
|
+
|
|
5
|
+
## Features
|
|
6
|
+
|
|
7
|
+
- 🚀 Modern ESLint 9+ support with flat config
|
|
8
|
+
- 📘 TypeScript support with type-checked rules
|
|
9
|
+
- 🎨 Stylistic rules for consistent code formatting
|
|
10
|
+
- ⚡ Zero-config experience with sensible defaults
|
|
11
|
+
- 📦 Modular design with optional dependencies
|
|
12
|
+
|
|
13
|
+
## Installation
|
|
14
|
+
|
|
15
|
+
```bash
|
|
16
|
+
npm install --save-dev @camaro/eslint-config eslint
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
For TypeScript support:
|
|
20
|
+
|
|
21
|
+
```bash
|
|
22
|
+
npm install --save-dev @camaro/eslint-config eslint typescript-eslint
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
## Usage
|
|
26
|
+
|
|
27
|
+
### Basic Configuration (JavaScript)
|
|
28
|
+
|
|
29
|
+
Create `eslint.config.js`:
|
|
30
|
+
|
|
31
|
+
```javascript
|
|
32
|
+
import config from '@camaro/eslint-config';
|
|
33
|
+
|
|
34
|
+
export default config;
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
### TypeScript Configuration
|
|
38
|
+
|
|
39
|
+
Create `eslint.config.js`:
|
|
40
|
+
|
|
41
|
+
```javascript
|
|
42
|
+
import { createTypescriptLintConfig } from '@camaro/eslint-config/typescript';
|
|
43
|
+
|
|
44
|
+
export default createTypescriptLintConfig({
|
|
45
|
+
files: ['**/*.ts', '**/*.tsx']
|
|
46
|
+
});
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
## Configuration Details
|
|
50
|
+
|
|
51
|
+
### Common Config
|
|
52
|
+
|
|
53
|
+
The base configuration includes:
|
|
54
|
+
|
|
55
|
+
- ESLint recommended rules
|
|
56
|
+
- Stylistic rules (code formatting, line breaks, spacing)
|
|
57
|
+
- Quality rules (eqeqeq, prefer-const)
|
|
58
|
+
- 4-space indentation
|
|
59
|
+
- Double quotes
|
|
60
|
+
- Semicolons required
|
|
61
|
+
|
|
62
|
+
### TypeScript Config
|
|
63
|
+
|
|
64
|
+
The TypeScript configuration extends the common config and adds:
|
|
65
|
+
|
|
66
|
+
- TypeScript ESLint recommended, strict, and stylistic rules
|
|
67
|
+
- Type-aware linting with `projectService`
|
|
68
|
+
- Support for `.ts` and `.tsx` files
|
|
69
|
+
- Consistent type import rules
|
|
70
|
+
|
|
71
|
+
## Rules
|
|
72
|
+
|
|
73
|
+
### Stylistic Rules
|
|
74
|
+
|
|
75
|
+
- `array-bracket-newline`: Enforce consistent newlines in array brackets
|
|
76
|
+
- `array-element-newline`: Enforce consistent newlines between array elements
|
|
77
|
+
- `function-call-spacing`: Enforce no spacing between function names and invocations
|
|
78
|
+
- `function-paren-newline`: Enforce multiline function arguments
|
|
79
|
+
- `max-len`: Enforce 120 character line limit
|
|
80
|
+
- `object-curly-newline`: Enforce consistent newlines in object brackets
|
|
81
|
+
|
|
82
|
+
### Quality Rules
|
|
83
|
+
|
|
84
|
+
- `eqeqeq`: Require strict equality operators
|
|
85
|
+
- `prefer-const`: Prefer `const` declarations
|
|
86
|
+
- `@typescript-eslint/consistent-type-imports`: Enforce consistent type import style
|
|
87
|
+
|
|
88
|
+
## Requirements
|
|
89
|
+
|
|
90
|
+
- **eslint**: >= 9.0.0
|
|
91
|
+
- **typescript-eslint**: >= 8.0.0 (optional, only needed for TypeScript projects)
|
|
92
|
+
|
|
93
|
+
## License
|
|
94
|
+
|
|
95
|
+
MIT
|
package/lib/common.d.ts
CHANGED
|
@@ -1,2 +1 @@
|
|
|
1
|
-
|
|
2
|
-
export declare const common: Linter.Config[];
|
|
1
|
+
export declare const common: import("eslint/config").Config[];
|
package/lib/common.js
CHANGED
|
@@ -1,23 +1,20 @@
|
|
|
1
1
|
import eslintJS from "@eslint/js";
|
|
2
2
|
import stylistic from "@stylistic/eslint-plugin";
|
|
3
|
-
|
|
3
|
+
import { defineConfig } from "eslint/config";
|
|
4
|
+
const styleLintConfig = stylistic.configs.customize({
|
|
4
5
|
indent: 4,
|
|
5
6
|
quotes: "double",
|
|
6
7
|
semi: true,
|
|
7
8
|
});
|
|
8
|
-
export const common =
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
"@stylistic/function-paren-newline": ["error", "multiline-arguments"],
|
|
19
|
-
"@stylistic/max-len": ["error", { code: 120 }],
|
|
20
|
-
"@stylistic/object-curly-newline": "error",
|
|
21
|
-
},
|
|
9
|
+
export const common = defineConfig(eslintJS.configs.recommended, styleLintConfig, {
|
|
10
|
+
rules: {
|
|
11
|
+
"eqeqeq": "error",
|
|
12
|
+
"prefer-const": ["error", { destructuring: "all" }],
|
|
13
|
+
"@stylistic/array-bracket-newline": "error",
|
|
14
|
+
"@stylistic/array-element-newline": ["error", "consistent"],
|
|
15
|
+
"@stylistic/function-call-spacing": ["error", "never"],
|
|
16
|
+
"@stylistic/function-paren-newline": ["error", "multiline-arguments"],
|
|
17
|
+
"@stylistic/max-len": ["error", { code: 120 }],
|
|
18
|
+
"@stylistic/object-curly-newline": "error",
|
|
22
19
|
},
|
|
23
|
-
|
|
20
|
+
});
|
package/lib/typescript.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import type
|
|
2
|
-
export declare const
|
|
1
|
+
import { type Config } from "eslint/config";
|
|
2
|
+
export declare const createTypescriptLintConfig: (options?: Config) => Config[];
|
package/lib/typescript.js
CHANGED
|
@@ -1,22 +1,34 @@
|
|
|
1
1
|
import eslintTS from "typescript-eslint";
|
|
2
2
|
import { common } from "./common.js";
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
...
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
3
|
+
import { defineConfig } from "eslint/config";
|
|
4
|
+
export const createTypescriptLintConfig = (options = {}) => {
|
|
5
|
+
const { languageOptions, rules, ...restOptions } = options;
|
|
6
|
+
return defineConfig(common, {
|
|
7
|
+
extends: [
|
|
8
|
+
eslintTS.configs.recommendedTypeChecked,
|
|
9
|
+
eslintTS.configs.strictTypeChecked,
|
|
10
|
+
eslintTS.configs.stylisticTypeChecked,
|
|
11
|
+
],
|
|
12
12
|
languageOptions: {
|
|
13
13
|
parser: eslintTS.parser,
|
|
14
14
|
parserOptions: { projectService: true },
|
|
15
|
+
...languageOptions,
|
|
15
16
|
},
|
|
16
|
-
plugins: { "@typescript-eslint": eslintTS.plugin },
|
|
17
17
|
rules: {
|
|
18
|
-
...eslintTsRules,
|
|
19
18
|
"@typescript-eslint/consistent-type-imports": ["error", { fixStyle: "inline-type-imports" }],
|
|
19
|
+
"@typescript-eslint/restrict-template-expressions": [
|
|
20
|
+
"error",
|
|
21
|
+
{
|
|
22
|
+
allow: [{ name: ["Error", "URL", "URLSearchParams"], from: "lib" }],
|
|
23
|
+
allowAny: true,
|
|
24
|
+
allowBoolean: true,
|
|
25
|
+
allowNullish: true,
|
|
26
|
+
allowNumber: true,
|
|
27
|
+
allowRegExp: true,
|
|
28
|
+
},
|
|
29
|
+
],
|
|
30
|
+
...rules,
|
|
20
31
|
},
|
|
21
|
-
|
|
22
|
-
|
|
32
|
+
...restOptions,
|
|
33
|
+
});
|
|
34
|
+
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@camaro/eslint-config",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.4",
|
|
4
4
|
"description": "A shareable eslint config.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"exports": {
|
|
@@ -12,7 +12,16 @@
|
|
|
12
12
|
"test": "tsx ./test/index.ts",
|
|
13
13
|
"type-check": "tsc --noEmit && tsc -p test/tsconfig.json --noEmit"
|
|
14
14
|
},
|
|
15
|
-
"keywords": [
|
|
15
|
+
"keywords": [
|
|
16
|
+
"eslint",
|
|
17
|
+
"eslint-config",
|
|
18
|
+
"eslint-config-airbnb",
|
|
19
|
+
"shared-config",
|
|
20
|
+
"typescript",
|
|
21
|
+
"stylistic",
|
|
22
|
+
"code-style",
|
|
23
|
+
"linting"
|
|
24
|
+
],
|
|
16
25
|
"dependencies": {
|
|
17
26
|
"@eslint/js": "^9.39.1",
|
|
18
27
|
"@stylistic/eslint-plugin": "^5.6.1"
|