Skip to content

Commit 330e3a0

Browse files
committed
feat(eslint-config): drop eslint-plugin-prettier in favor of prettier directly
1 parent 2a4404a commit 330e3a0

27 files changed

+68
-110
lines changed

.changeset/early-llamas-yawn.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'@apitree.cz/eslint-config': patch
3+
---
4+
5+
Remove `eslint-plugin-prettier` in favor of `prettier` directly (only `eslint-config-prettier` overrides are applied).

lint-staged.config.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
export default {
2-
'./*.{cjs,js}': 'eslint --cache --fix',
3-
'./*.{json,md,yml,yaml}': 'prettier --write',
2+
'./*.js': 'eslint --cache --fix',
3+
'./*.{js,json,md,yml,yaml}': 'prettier --write',
44
'./.changeset/**/*.{json,md}': 'prettier --write',
55
'./.github/**/*.{yml,yaml}': 'prettier --write',
66
};

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,12 +16,12 @@
1616
"scripts": {
1717
"build": "turbo run build --no-daemon",
1818
"cleanup": "turbo run cleanup --no-daemon",
19-
"postcleanup": "del .eslintcache tsconfig.tsbuildinfo node_modules",
19+
"postcleanup": "del .eslintcache .turbo tsconfig.tsbuildinfo node_modules",
2020
"fix": "turbo run fix --no-daemon",
2121
"postfix": "run-p postts postformat:fix postlint:fix",
2222
"format": "turbo run format --no-daemon --parallel",
2323
"format:fix": "turbo run format:fix --no-daemon --parallel",
24-
"postformat": "prettier --check \"./*.{json,md,yaml}\" \".github/**/*.yaml\"",
24+
"postformat": "prettier --check \"./*.{js,json,md,yaml}\" \".changeset/**/*.md\" \".github/**/*.yaml\"",
2525
"postformat:fix": "pnpm run postformat --write",
2626
"postinstall": "is-ci || manypkg check",
2727
"lint": "turbo run lint --no-daemon",

packages/cli/lint-staged.config.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
export default {
2-
'./**/.{cjs,js,ts}': 'eslint --cache --fix',
3-
'./**/*.{json,md}': 'prettier --write',
2+
'./**/*.{js,ts}': 'eslint --cache --fix',
3+
'./**/*.{js,json,md,ts}': 'prettier --write',
4+
'./**/*.ts': [() => 'tsc --build tsconfig.json'],
45
};

packages/cli/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
"docs:format": "prettier --write \"./docs/**/*\"",
2626
"docs:generate": "typedoc",
2727
"fix": "run-p ts format:fix lint:fix",
28-
"format": "prettier --check \"./**/*.{json,md}\"",
28+
"format": "prettier --check \"./**/*.{js,json,md,ts}\"",
2929
"format:fix": "pnpm run format --write",
3030
"lint": "eslint --cache .",
3131
"lint:fix": "pnpm run lint --fix",
Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
export default {
2-
'./**/*.js': 'eslint --cache --fix',
3-
'./**/*.{json,md}': 'prettier --write',
4-
'./**/*.ts': [() => 'tsc --build tsconfig.json', 'eslint --cache --fix'],
2+
'./**/*.{js,ts}': 'eslint --cache --fix',
3+
'./**/*.{js,json,md,ts}': 'prettier --write',
4+
'./**/*.ts': [() => 'tsc --build tsconfig.json'],
55
};

packages/eslint-config/package.json

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@
4343
"build": "tsc --build tsconfig.build.json",
4444
"cleanup": "del .eslintcache .turbo tsconfig.tsbuildinfo tsconfig.build.tsbuildinfo dist node_modules",
4545
"fix": "run-p ts format:fix lint:fix",
46-
"format": "prettier --check \"./**/*.{json,md}\"",
46+
"format": "prettier --check \"./**/*.{js,json,md,ts}\"",
4747
"format:fix": "pnpm run format --write",
4848
"lint": "eslint --cache .",
4949
"lint:fix": "pnpm run lint --fix",
@@ -65,7 +65,6 @@
6565
"eslint-plugin-jest-dom": "^5.5.0",
6666
"eslint-plugin-jsx-a11y": "^6.10.2",
6767
"eslint-plugin-mdx": "^3.1.5",
68-
"eslint-plugin-prettier": "^5.2.3",
6968
"eslint-plugin-react": "^7.37.4",
7069
"eslint-plugin-react-hooks": "^5.1.0",
7170
"eslint-plugin-storybook": "^0.11.2",
@@ -80,7 +79,6 @@
8079
"devDependencies": {
8180
"@types/eslint__eslintrc": "^2.1.2",
8281
"eslint": "^9.19.0",
83-
"prettier": "^3.4.2",
8482
"react": "^19.0.0",
8583
"typescript": "^5.7.3"
8684
},

packages/eslint-config/src/base/config.ts

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
11
import eslint from '@eslint/js';
22
import vitest from '@vitest/eslint-plugin';
3-
import type { Linter } from 'eslint';
4-
import imports from 'eslint-plugin-import';
5-
import prettier from 'eslint-plugin-prettier/recommended';
3+
import prettier from 'eslint-config-prettier';
4+
import * as imports from 'eslint-plugin-import';
65
import turbo from 'eslint-plugin-turbo';
76
import unicorn from 'eslint-plugin-unicorn';
87
import unusedImports from 'eslint-plugin-unused-imports';
@@ -35,9 +34,8 @@ export const config: ConfigArray = tsEslint.config(
3534
],
3635
},
3736
eslint.configs.recommended,
38-
prettier,
3937
{
40-
extends: [imports.flatConfigs.recommended, imports.flatConfigs.typescript] as Linter.Config[],
38+
extends: [imports.flatConfigs.recommended, imports.flatConfigs.typescript],
4139
plugins: {
4240
'@typescript-eslint': tsEslintPlugin,
4341
'unused-imports': unusedImports,
@@ -100,4 +98,5 @@ export const config: ConfigArray = tsEslint.config(
10098
files: ['**/*.d.ts'],
10199
rules: rules.dts,
102100
},
101+
prettier,
103102
);

packages/eslint-config/src/base/rules/common.ts

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
import type { Linter } from 'eslint';
22

3-
const lineLength = 120;
4-
53
export const common: Linter.RulesRecord = {
64
'array-callback-return': [
75
'error',
@@ -10,28 +8,13 @@ export const common: Linter.RulesRecord = {
108
},
119
], // Allow implicit return in array methods
1210
'arrow-body-style': ['error', 'as-needed'], // Allow omitting braces when possible
13-
'arrow-parens': ['error', 'always'], // Require parens around arrow function arguments
14-
'comma-dangle': 'off', // Allow dangling commas
1511
'consistent-return': 'off', // Allow implicit return in arrow functions
1612
curly: ['error', 'all'], // Require braces around all blocks
1713
'default-case': 'off', // Allow switch statements without default
1814
'function-paren-newline': 'off', // Allow parens on same line as function name
1915
'guard-for-in': 'off', // Allow for-in without if statement
2016
'implicit-arrow-linebreak': 'off', // Allow implicit return in arrow functions
2117
'max-classes-per-file': ['error', { ignoreExpressions: true, max: 3 }], // Allow multiple classes per file
22-
'max-len': [
23-
// Enforce max line length
24-
'error',
25-
lineLength, // Characters per line
26-
2, // Tab width
27-
{
28-
ignoreUrls: true, // Let URLs be as long as they need to be
29-
ignoreComments: true, // Allow comments to be as long as they need to be
30-
ignoreRegExpLiterals: true, // Let regex literals be as long as they need to be
31-
ignoreStrings: true, // Let strings be as long as they need to be
32-
ignoreTemplateLiterals: true, // Let template literals be as long as they need to be
33-
},
34-
],
3518
'no-confusing-arrow': 'off', // Do not guard against confusing arrow functions as we enforce parens
3619
'no-console': 'warn', // Warn against console.log
3720
'no-debugger': 'warn', // Warn against debugger
@@ -67,5 +50,4 @@ export const common: Linter.RulesRecord = {
6750
'no-shadow': 'off', // Allow variables shadowing
6851
'no-use-before-define': 'off', // Guarded by @typescript-eslint/no-use-before-define
6952
'no-warning-comments': ['warn', { terms: ['fixme', 'todo'] }], // Warn against fixme and todo comments
70-
'object-curly-newline': ['error', { consistent: true }], // Enforce consistent line breaks inside braces
7153
};

packages/eslint-config/src/base/rules/typescript.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ export const typescript: Linter.RulesRecord = {
99
'@typescript-eslint/no-unsafe-declaration-merging': 'error', // Guard declaration merging against unsafe usage
1010
'@typescript-eslint/no-unused-vars': 'off', // Guarded by eslint-plugin-unused-imports
1111
'@typescript-eslint/no-use-before-define': 'error', // Disallow usage of variables before their declaration
12-
// Enforce template literal expressions to be of string type
12+
// Enforce template literal expressions to be of string type or safely cast to string (no complex types)
1313
'@typescript-eslint/restrict-template-expressions': [
1414
'error',
1515
{ allowBoolean: true, allowNumber: true, allowNullish: true },

0 commit comments

Comments
 (0)