@pplancq/eslint-config 6.0.19 → 6.1.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/CHANGELOG.md CHANGED
@@ -1,3 +1,25 @@
1
+ ## 6.1.0 (2026-08-14)
2
+
3
+ ### 🎉 Features
4
+
5
+ - **eslint-config:** use eslint-config-prettier dependency and integration ([87d6f88c](https://github.com/pplancq/dev-tools/commit/87d6f88c))
6
+ - **eslint-config:** deprecate enablePrettier option ([906698a1](https://github.com/pplancq/dev-tools/commit/906698a1))
7
+
8
+ ### 🐞 Bug Fixes
9
+
10
+ - **eslint-config:** dynamically import prettier rules if available ([bf595cd6](https://github.com/pplancq/dev-tools/commit/bf595cd6))
11
+
12
+ ### 📦 Dependencies
13
+
14
+ - **deps:** update dependency @vitest/eslint-plugin to ^1.6.27 ([#1854](https://github.com/pplancq/dev-tools/pull/1854))
15
+ - **deps:** update typescript-eslint mono repo to ^8.67.0 ([#1861](https://github.com/pplancq/dev-tools/pull/1861))
16
+ - **deps:** update dependency globals to ^17.9.0 ([#1859](https://github.com/pplancq/dev-tools/pull/1859))
17
+ - **deps:** update dependency eslint-plugin-jest-dom to ^5.10.1 ([#1858](https://github.com/pplancq/dev-tools/pull/1858))
18
+
19
+ ### ❤️ Thank You
20
+
21
+ - Paul PLANCQ
22
+
1
23
  ## 6.0.19 (2026-08-03)
2
24
 
3
25
  ### ♻️ Code Refactoring
package/README.md CHANGED
@@ -42,23 +42,38 @@ export default defineConfig({
42
42
 
43
43
  The following options can be passed to the `defineConfig` function. All options are optional. By default, this configuration includes rules for base, import, and TypeScript files.
44
44
 
45
- | Option | Default | Description |
46
- | ---------------- | ------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
47
- | tsFiles | ['**/*.ts?(x)'] | Patterns for TypeScript files |
48
- | unitTestFiles | ['**/*.{test,spec,steps}.{js,jsx,ts,tsx}'] | Patterns for unit test files |
49
- | unitE2eFiles | ['tests/**/*.{test,spec}.{js,jsx,ts,tsx}'] | Patterns for end-to-end (E2E) test files (ex: Playwright) |
50
- | enableReact | false | Enables rules for React and Testing Library files |
51
- | enableVitest | false | Enables rules for Vitest files |
52
- | enablePlaywright | false | Enables rules for Playwright E2E test files |
53
- | enablePrettier | 'off' | 'off' disables Prettier rules<br/>'on' enables Prettier rules<br/>'disableStyleOnly' enables Prettier rules but disables the 'prettier/prettier' rule, not using Prettier CLI for formatting your code |
54
- | extendConfig | [] | Extends the ESLint configuration |
45
+ | Option | Default | Description |
46
+ | ---------------- | ------------------------------------------ | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
47
+ | tsFiles | ['**/*.ts?(x)'] | Patterns for TypeScript files |
48
+ | unitTestFiles | ['**/*.{test,spec,steps}.{js,jsx,ts,tsx}'] | Patterns for unit test files |
49
+ | unitE2eFiles | ['tests/**/*.{test,spec}.{js,jsx,ts,tsx}'] | Patterns for end-to-end (E2E) test files (ex: Playwright) |
50
+ | enableReact | false | Enables rules for React and Testing Library files |
51
+ | enableVitest | false | Enables rules for Vitest files |
52
+ | enablePlaywright | false | Enables rules for Playwright E2E test files |
53
+ | enablePrettier | 'off' | 'off' disables Prettier integration (default). Recommended when using Prettier separately; install `eslint-config-prettier` to disable conflicting ESLint formatting rules<br/>'on' enables Prettier as an ESLint rule. **Deprecated**, will be removed in the next major release<br/>'disableStyleOnly' disables conflicting ESLint formatting rules without running Prettier as an ESLint rule. Recommended transition option to keep the same behavior as `'on'` while running Prettier separately |
54
+ | extendConfig | [] | Extends the ESLint configuration |
55
55
 
56
56
  ### Prettier Configuration
57
57
 
58
- If you set `enablePrettier: 'on'`, you will need to install the following packages:
58
+ > ⚠️ **Deprecated:** `enablePrettier: 'on'` is deprecated and will be removed in the next major release.
59
+ > It is recommended to use `enablePrettier: 'disableStyleOnly'` and run Prettier separately for formatting.
60
+ > This keeps the same behavior as `'on'` without running Prettier as an ESLint rule.
61
+
62
+ If you use Prettier, install the following package:
59
63
 
60
64
  ```shell
61
- npm install --save-dev prettier eslint-plugin-prettier
65
+ npm install --save-dev prettier
66
+ ```
67
+
68
+ Then update your ESLint config:
69
+
70
+ ```javascript
71
+ // eslint.config.mjs
72
+ import { defineConfig } from "@pplancq/eslint-config";
73
+
74
+ export default defineConfig({
75
+ enablePrettier: "disableStyleOnly",
76
+ });
62
77
  ```
63
78
 
64
79
  ## Rules Documentation
package/main.js CHANGED
@@ -1,13 +1,32 @@
1
1
  /* eslint-disable import/extensions */
2
+ import eslintConfigPrettier from "eslint-config-prettier/flat";
2
3
  import { baseRules } from "./rules/base.js";
3
4
  import { importRules } from "./rules/import.js";
4
5
  import { playwrightRules } from "./rules/playwright.js";
5
- import { prettierRules } from "./rules/prettier.js";
6
6
  import { reactJsxA11yRules } from "./rules/react-jsx-a11y.js";
7
7
  import { reactRules, reactTestRules, reactTypescriptRules } from "./rules/react.js";
8
8
  import { typescriptRules } from "./rules/typescript.js";
9
9
  import { vitestRules } from "./rules/vitest.js";
10
10
 
11
+ let prettierRules = {};
12
+ try {
13
+ const prettierConfig = await import("./rules/prettier.js");
14
+ prettierRules = prettierConfig.prettierRules;
15
+ } catch {
16
+ // eslint-plugin-prettier is not installed
17
+ }
18
+
19
+ const isColorSupported =
20
+ !process.env.NO_COLOR &&
21
+ !process.argv.includes("--no-color") &&
22
+ (process.env.FORCE_COLOR ||
23
+ process.argv.includes("--color") ||
24
+ process.platform === "win32" ||
25
+ process.stdout?.isTTY);
26
+
27
+ const yellow = isColorSupported ? (text) => `\x1b[33m${text}\x1b[39m` : (text) => text;
28
+ const bold = isColorSupported ? (text) => `\x1b[1m${text}\x1b[22m` : (text) => text;
29
+
11
30
  /**
12
31
  * define eslint flat config.
13
32
  *
@@ -18,7 +37,14 @@ import { vitestRules } from "./rules/vitest.js";
18
37
  * @param {boolean} [options.enableReact=false]
19
38
  * @param {boolean} [options.enableVitest=false]
20
39
  * @param {boolean} [options.enablePlaywright=false]
21
- * @param {'off' | 'on' | 'disableStyleOnly'} [options.enablePrettier='on']
40
+ * @param {'off' | 'on' | 'disableStyleOnly'} [options.enablePrettier='off']
41
+ * - `'off'`: disables Prettier integration (default).
42
+ * Recommended when using Prettier separately; install `eslint-config-prettier` to disable conflicting ESLint formatting rules.
43
+ * Note: rules such as `arrow-body-style`, `curly` and `prefer-arrow-callback` are not formatting rules and will need to be disabled manually if you want to keep the previous behavior.
44
+ * - `'on'`: enables Prettier as an ESLint rule. **Deprecated**, will be removed in the next major release.
45
+ * Use `'disableStyleOnly'` and run Prettier separately instead.
46
+ * - `'disableStyleOnly'`: disables conflicting ESLint formatting rules without running Prettier as an ESLint rule.
47
+ * Recommended transition option to keep the same behavior as `'on'` while running Prettier separately.
22
48
  * @param {Array<import('eslint').Linter.Config>} [options.extendConfig=[]]
23
49
  *
24
50
  * @returns {import('eslint').Linter.Config}
@@ -39,6 +65,12 @@ export const defineConfig = ({
39
65
  vitestRules.files = unitTestFiles;
40
66
  playwrightRules.files = unitE2eFiles;
41
67
 
68
+ if (enablePrettier === "on") {
69
+ console.warn(
70
+ `${bold(yellow("WARNING:"))} [enablePrettier: 'on'] is deprecated and will be removed in the next major release. Use 'disableStyleOnly' and run Prettier separately for formatting.`,
71
+ );
72
+ }
73
+
42
74
  if (enablePrettier === "disableStyleOnly") {
43
75
  prettierRules.rules["prettier/prettier"] = "off";
44
76
  }
@@ -52,6 +84,7 @@ export const defineConfig = ({
52
84
  enableReact && reactTypescriptRules,
53
85
  enableReact && reactTestRules,
54
86
  enablePrettier !== "off" && prettierRules,
87
+ enablePrettier !== "off" && eslintConfigPrettier,
55
88
  enableVitest && vitestRules,
56
89
  enablePlaywright && playwrightRules,
57
90
  {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pplancq/eslint-config",
3
- "version": "6.0.19",
3
+ "version": "6.1.0",
4
4
  "license": "MIT",
5
5
  "description": "pplancq eslint config",
6
6
  "author": "pplancq <paul.plancq@outlook.fr>",
@@ -13,8 +13,8 @@
13
13
  "docs:generate": "node scripts/generate-docs.mjs",
14
14
  "lint:eslint": "eslint \"**/*.{js,mjs}\"",
15
15
  "lint:eslint:fix": "eslint \"**/*.{js,mjs}\" --fix",
16
- "lint:prettier": "prettier \"**/*.!(js|mjs)\" --check --ignore-unknown",
17
- "lint:prettier:fix": "prettier \"**/*.!(js|mjs)\" --write --ignore-unknown"
16
+ "lint:prettier": "prettier . --check --ignore-unknown",
17
+ "lint:prettier:fix": "prettier . --write --ignore-unknown"
18
18
  },
19
19
  "files": [
20
20
  "bin",
@@ -37,22 +37,22 @@
37
37
  "config"
38
38
  ],
39
39
  "dependencies": {
40
- "@typescript-eslint/eslint-plugin": "^8.65.0",
41
- "@typescript-eslint/parser": "^8.65.0",
42
- "@vitest/eslint-plugin": "^1.6.24",
40
+ "@typescript-eslint/eslint-plugin": "^8.67.0",
41
+ "@typescript-eslint/parser": "^8.67.0",
42
+ "@vitest/eslint-plugin": "^1.6.27",
43
+ "eslint-config-prettier": "^10.1.8",
43
44
  "eslint-import-resolver-typescript": "^4.4.5",
44
45
  "eslint-plugin-import": "^2.32.0",
45
- "eslint-plugin-jest-dom": "^5.7.0",
46
+ "eslint-plugin-jest-dom": "^5.10.1",
46
47
  "eslint-plugin-jsx-a11y": "^6.10.2",
47
48
  "eslint-plugin-playwright": "^2.11.0",
48
49
  "eslint-plugin-react": "^7.37.5",
49
50
  "eslint-plugin-react-hooks": "^7.1.1",
50
51
  "eslint-plugin-testing-library": "^7.16.2",
51
- "globals": "^17.8.0"
52
+ "globals": "^17.9.0"
52
53
  },
53
54
  "peerDependencies": {
54
55
  "eslint": "^9.14.0",
55
- "eslint-plugin-prettier": "^5.0.1",
56
56
  "prettier": "^3.2.5"
57
57
  },
58
58
  "peerDependenciesMeta": {
@@ -66,7 +66,7 @@
66
66
  "devDependencies": {
67
67
  "eslint": "^9.39.5",
68
68
  "eslint-plugin-prettier": "^5.5.6",
69
- "lint-staged": "^17.2.0",
69
+ "lint-staged": "^17.3.0",
70
70
  "prettier": "^3.9.6"
71
71
  },
72
72
  "engines": {
@@ -75,6 +75,6 @@
75
75
  "prettier": "@pplancq/prettier-config",
76
76
  "lint-staged": {
77
77
  "*.(js|mjs)": "eslint --fix",
78
- "*.!(js|mjs)": "prettier --write --ignore-unknown"
78
+ "*": "prettier --write --ignore-unknown"
79
79
  }
80
80
  }
package/rules/prettier.js CHANGED
@@ -1,3 +1,4 @@
1
+ // eslint-disable-next-line import/no-extraneous-dependencies
1
2
  import prettierPlugin from "eslint-plugin-prettier";
2
3
 
3
4
  export const prettierRules = {
@@ -8,130 +9,5 @@ export const prettierRules = {
8
9
  // eslint-plugin-prettier
9
10
  // https://github.com/prettier/eslint-plugin-prettier
10
11
  "prettier/prettier": "error",
11
-
12
- // eslint
13
- "arrow-body-style": "off",
14
- curly: "off",
15
- "no-unexpected-multiline": "off",
16
- "prefer-arrow-callback": "off",
17
-
18
- // typescript-eslint/typescript-eslint https://github.com/typescript-eslint/typescript-eslint
19
- "@typescript-eslint/block-spacing": "off",
20
- "@typescript-eslint/brace-style": "off",
21
- "@typescript-eslint/comma-dangle": "off",
22
- "@typescript-eslint/comma-spacing": "off",
23
- "@typescript-eslint/func-call-spacing": "off",
24
- "@typescript-eslint/indent": "off",
25
- "@typescript-eslint/key-spacing": "off",
26
- "@typescript-eslint/keyword-spacing": "off",
27
- "@typescript-eslint/lines-around-comment": "off",
28
- "@typescript-eslint/member-delimiter-style": "off",
29
- "@typescript-eslint/no-extra-parens": "off",
30
- "@typescript-eslint/no-extra-semi": "off",
31
- "@typescript-eslint/object-curly-spacing": "off",
32
- "@typescript-eslint/quotes": "off",
33
- "@typescript-eslint/semi": "off",
34
- "@typescript-eslint/space-before-blocks": "off",
35
- "@typescript-eslint/space-before-function-paren": "off",
36
- "@typescript-eslint/space-infix-ops": "off",
37
- "@typescript-eslint/type-annotation-spacing": "off",
38
-
39
- // eslint-plugin-react https://github.com/jsx-eslint/eslint-plugin-react
40
- "react/jsx-child-element-spacing": "off",
41
- "react/jsx-closing-bracket-location": "off",
42
- "react/jsx-closing-tag-location": "off",
43
- "react/jsx-curly-newline": "off",
44
- "react/jsx-curly-spacing": "off",
45
- "react/jsx-equals-spacing": "off",
46
- "react/jsx-first-prop-new-line": "off",
47
- "react/jsx-indent": "off",
48
- "react/jsx-indent-props": "off",
49
- "react/jsx-max-props-per-line": "off",
50
- "react/jsx-newline": "off",
51
- "react/jsx-one-expression-per-line": "off",
52
- "react/jsx-props-no-multi-spaces": "off",
53
- "react/jsx-tag-spacing": "off",
54
- "react/jsx-wrap-multilines": "off",
55
-
56
- // Deprecated eslint-plugin-react
57
- // Deprecated since version 7.0.0.
58
- // https://github.com/yannickcr/eslint-plugin-react/blob/master/CHANGELOG.md#700---2017-05-06
59
- "react/jsx-space-before-closing": "off",
60
-
61
- // Deprecated eslint
62
- // Deprecated since version 3.3.0.
63
- // https://eslint.org/docs/rules/no-spaced-func
64
- "no-spaced-func": "off",
65
-
66
- // Deprecated since version 4.0.0.
67
- // https://github.com/eslint/eslint/pull/8286
68
- "indent-legacy": "off",
69
-
70
- // Deprecated since version 8.53.0.
71
- // https://eslint.org/blog/2023/10/deprecating-formatting-rules/
72
- "array-bracket-newline": "off",
73
- "array-bracket-spacing": "off",
74
- "array-element-newline": "off",
75
- "arrow-parens": "off",
76
- "arrow-spacing": "off",
77
- "block-spacing": "off",
78
- "brace-style": "off",
79
- "comma-dangle": "off",
80
- "comma-spacing": "off",
81
- "comma-style": "off",
82
- "computed-property-spacing": "off",
83
- "dot-location": "off",
84
- "eol-last": "off",
85
- "func-call-spacing": "off",
86
- "function-call-argument-newline": "off",
87
- "function-paren-newline": "off",
88
- "generator-star-spacing": "off",
89
- "implicit-arrow-linebreak": "off",
90
- indent: "off",
91
- "jsx-quotes": "off",
92
- "key-spacing": "off",
93
- "keyword-spacing": "off",
94
- "linebreak-style": "off",
95
- "lines-around-comment": "off",
96
- "max-len": "off",
97
- "max-statements-per-line": "off",
98
- "multiline-ternary": "off",
99
- "new-parens": "off",
100
- "newline-per-chained-call": "off",
101
- "no-confusing-arrow": "off",
102
- "no-extra-parens": "off",
103
- "no-extra-semi": "off",
104
- "no-floating-decimal": "off",
105
- "no-mixed-operators": "off",
106
- "no-mixed-spaces-and-tabs": "off",
107
- "no-multi-spaces": "off",
108
- "no-multiple-empty-lines": "off",
109
- "no-tabs": "off",
110
- "no-trailing-spaces": "off",
111
- "no-whitespace-before-property": "off",
112
- "nonblock-statement-body-position": "off",
113
- "object-curly-newline": "off",
114
- "object-curly-spacing": "off",
115
- "object-property-newline": "off",
116
- "one-var-declaration-per-line": "off",
117
- "operator-linebreak": "off",
118
- "padded-blocks": "off",
119
- "quote-props": "off",
120
- quotes: "off",
121
- "rest-spread-spacing": "off",
122
- semi: "off",
123
- "semi-spacing": "off",
124
- "semi-style": "off",
125
- "space-before-blocks": "off",
126
- "space-before-function-paren": "off",
127
- "space-in-parens": "off",
128
- "space-infix-ops": "off",
129
- "space-unary-ops": "off",
130
- "switch-colon-spacing": "off",
131
- "template-curly-spacing": "off",
132
- "template-tag-spacing": "off",
133
- "wrap-iife": "off",
134
- "wrap-regex": "off",
135
- "yield-star-spacing": "off",
136
12
  },
137
13
  };