@camaro/eslint-config 0.1.2 → 0.1.3

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 CHANGED
@@ -1,5 +1,12 @@
1
1
  # Changelog
2
2
 
3
+ ## [0.1.3](https://github.com/camarojs/camaro/compare/eslint-config-v0.1.2...eslint-config-v0.1.3) (2026-02-09)
4
+
5
+
6
+ ### Features
7
+
8
+ * **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))
9
+
3
10
  ## [0.1.2](https://github.com/camarojs/camaro/compare/eslint-config-v0.1.1...eslint-config-v0.1.2) (2026-01-30)
4
11
 
5
12
 
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
- import { type Linter } from "eslint";
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
- const styleLint = stylistic.configs.customize({
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
- eslintJS.configs.recommended,
10
- styleLint,
11
- {
12
- rules: {
13
- "eqeqeq": "error",
14
- "prefer-const": ["error", { destructuring: "all" }],
15
- "@stylistic/array-bracket-newline": "error",
16
- "@stylistic/array-element-newline": ["error", "consistent"],
17
- "@stylistic/function-call-spacing": ["error", "never"],
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
+ });
@@ -1,2 +1,5 @@
1
1
  import type { TSESLint } from "@typescript-eslint/utils";
2
- export declare const ts: TSESLint.FlatConfig.ConfigArray;
2
+ export interface TypescriptLintConfigOptions {
3
+ files: string[];
4
+ }
5
+ export declare const createTypescriptLintConfig: (options: TypescriptLintConfigOptions) => TSESLint.FlatConfig.ConfigArray;
package/lib/typescript.js CHANGED
@@ -1,22 +1,20 @@
1
1
  import eslintTS from "typescript-eslint";
2
2
  import { common } from "./common.js";
3
- const eslintTsRules = [
4
- ...eslintTS.configs.recommendedTypeChecked,
5
- ...eslintTS.configs.strictTypeChecked,
6
- ...eslintTS.configs.stylisticTypeChecked,
7
- ].reduce((acc, config) => ({ ...acc, ...config.rules }), {});
8
- export const ts = [
9
- ...common,
10
- {
11
- files: ["**/*.ts", "**/*.tsx"],
3
+ import { defineConfig } from "eslint/config";
4
+ export const createTypescriptLintConfig = (options) => {
5
+ return defineConfig(common, {
6
+ files: options.files,
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
15
  },
16
- plugins: { "@typescript-eslint": eslintTS.plugin },
17
16
  rules: {
18
- ...eslintTsRules,
19
17
  "@typescript-eslint/consistent-type-imports": ["error", { fixStyle: "inline-type-imports" }],
20
18
  },
21
- },
22
- ];
19
+ });
20
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@camaro/eslint-config",
3
- "version": "0.1.2",
3
+ "version": "0.1.3",
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"