@dauphaihau/eslint-config 0.2.1 → 0.2.2

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.
Files changed (3) hide show
  1. package/README.md +30 -12
  2. package/dist/index.js +15 -19
  3. package/package.json +6 -3
package/README.md CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  - Auto fix for formatting (aimed to be used standalone without Prettier)
4
4
  - Opinionated, but very customizable
5
- - Optional TypeScript support
5
+ - Auto-detects your tech stack (React, TypeScript, Tailwind, etc.)
6
6
  - ESLint Flat config, compose easily!
7
7
 
8
8
  ## Installation
@@ -15,9 +15,12 @@ And create `eslint.config.mjs` in your project root:
15
15
 
16
16
  ```js
17
17
  // eslint.config.mjs
18
- import dauphaihau from '@dauphaihau/eslint-config'
18
+ import dauphaihauConfig from '@dauphaihau/eslint-config'
19
+ import { defineConfig } from 'eslint/config'
19
20
 
20
- export default dauphaihau()
21
+ export default defineConfig([
22
+ ...(await dauphaihauConfig())
23
+ ])
21
24
  ```
22
25
 
23
26
  ### Add script for package.json
@@ -36,25 +39,40 @@ For example:
36
39
  ## Usage
37
40
 
38
41
  ### Basic
39
- Normally you only need to import the dauphaihau preset:
42
+ Normally you only need to import the dauphaihauConfig preset:
40
43
 
41
44
  ```js
42
45
  // eslint.config.js
43
- import dauphaihau from '@dauphaihau/eslint-config'
46
+ import dauphaihauConfig from '@dauphaihau/eslint-config'
47
+ import { defineConfig } from 'eslint/config'
44
48
 
45
- export default dauphaihau()
49
+ export default defineConfig([
50
+ ...(await dauphaihauConfig())
51
+ ])
46
52
  ```
47
53
 
48
54
  ### Customize
49
55
 
56
+ The config auto-detects your tech stack. Pass `false` to explicitly disable rules for a specific stack:
57
+
50
58
  ```js
51
59
  // eslint.config.js
52
- import dauphaihau from '@dauphaihau/eslint-config'
53
-
54
- export default dauphaihau({
55
- typescript: true,
56
- })
57
-
60
+ import dauphaihauConfig from '@dauphaihau/eslint-config'
61
+ import { defineConfig } from 'eslint/config'
62
+
63
+ export default defineConfig([
64
+ ...(await dauphaihauConfig({
65
+ tailwind: false, // disable Tailwind rules
66
+ })),
67
+
68
+ // Your configs and overrides
69
+ {
70
+ files: ['**/*.{ts,tsx}'],
71
+ rules: {
72
+ '@typescript-eslint/explicit-function-return-type': 'off',
73
+ },
74
+ },
75
+ ])
58
76
  ```
59
77
  ## License
60
78
 
package/dist/index.js CHANGED
@@ -614,24 +614,6 @@ var identifierQualityRules = {
614
614
  "id-denylist": ["warn", "foo", "bar", "baz", "tmp", "arr", "obj", "data"]
615
615
  };
616
616
  var variableNamingSelectors = [
617
- // Valid examples: userName, fetchUsers, _internalValue
618
- {
619
- selector: ["variable", "function"],
620
- format: ["camelCase"],
621
- leadingUnderscore: "allow"
622
- // allows _privateVar
623
- },
624
- {
625
- // Enforce UPPER_CASE for exported constants.
626
- // Valid examples: API_BASE_URL, MAX_RETRY_COUNT, DEFAULT_TIMEOUT_MS
627
- selector: "variable",
628
- modifiers: ["const", "exported"],
629
- format: ["UPPER_CASE"],
630
- filter: {
631
- regex: "^[A-Z0-9_]+$",
632
- match: true
633
- }
634
- },
635
617
  // ---------- Boolean naming ----------
636
618
  {
637
619
  selector: "variable",
@@ -639,6 +621,20 @@ var variableNamingSelectors = [
639
621
  format: ["PascalCase", "camelCase"],
640
622
  prefix: ["is", "has", "should", "can", "did", "will"],
641
623
  filter: { regex: "^(is|has|should|can|did|will)[A-Z]", match: true }
624
+ },
625
+ {
626
+ // Valid examples: apiBaseUrl, DEFAULT_TIMEOUT_MS, _internalValue
627
+ selector: "variable",
628
+ modifiers: ["const"],
629
+ format: ["camelCase", "UPPER_CASE"],
630
+ leadingUnderscore: "allow"
631
+ },
632
+ // Valid examples: userName, fetchUsers, _internalValue
633
+ {
634
+ selector: ["variable", "function"],
635
+ format: ["camelCase"],
636
+ leadingUnderscore: "allow"
637
+ // allows _privateVar
642
638
  }
643
639
  ];
644
640
  var baseNamingSelectors = [
@@ -745,7 +741,7 @@ function namingConfig(options = {}) {
745
741
  selector: "variable",
746
742
  format: ["camelCase", "PascalCase"],
747
743
  filter: {
748
- regex: "^[A-Z]",
744
+ regex: "^[A-Z][a-zA-Z0-9]*$",
749
745
  match: true
750
746
  }
751
747
  },
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dauphaihau/eslint-config",
3
- "version": "0.2.1",
3
+ "version": "0.2.2",
4
4
  "type": "module",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -45,16 +45,19 @@
45
45
  "eslint-plugin-tailwindcss": "^3.18.2",
46
46
  "jiti": "^2.0.0",
47
47
  "tsup": "^8.0.0",
48
- "typescript": "^5.4.0"
48
+ "typescript": "^5.4.0",
49
+ "vitest": "^3.2.4"
49
50
  },
50
51
  "scripts": {
51
52
  "build": "pnpm exec tsup src/index.ts --dts --format esm --external @eslint/js --external @stylistic/eslint-plugin --external typescript-eslint --external eslint-plugin-check-file --external eslint-plugin-react --external eslint-plugin-react-hooks --external eslint-plugin-react-refresh --external eslint-plugin-tailwindcss",
52
53
  "lint": "eslint .",
53
54
  "lint:fix": "eslint . --fix",
55
+ "test": "vitest run",
54
56
  "typecheck": "tsc --noEmit",
55
57
  "version:patch": "pnpm build && pnpm version patch",
56
58
  "version:minor": "pnpm build && pnpm version minor",
57
59
  "version:major": "pnpm build && pnpm version major",
58
- "push": "git push --follow-tags"
60
+ "push:tags": "git push --follow-tags",
61
+ "ship": "pnpm publish --no-git-checks"
59
62
  }
60
63
  }