diff --git a/.husky/post-checkout b/.husky/post-checkout deleted file mode 100755 index 37341d3..0000000 --- a/.husky/post-checkout +++ /dev/null @@ -1,4 +0,0 @@ -#!/usr/bin/env sh -. "$(dirname -- "$0")/_/husky.sh" - -bun i diff --git a/.husky/post-merge b/.husky/post-merge deleted file mode 100755 index 37341d3..0000000 --- a/.husky/post-merge +++ /dev/null @@ -1,4 +0,0 @@ -#!/usr/bin/env sh -. "$(dirname -- "$0")/_/husky.sh" - -bun i diff --git a/.husky/pre-commit b/.husky/pre-commit index 33def46..52c7534 100755 --- a/.husky/pre-commit +++ b/.husky/pre-commit @@ -1,4 +1 @@ -#!/usr/bin/env sh -. "$(dirname -- "$0")/_/husky.sh" - bun pre-commit diff --git a/CHANGELOG.md b/CHANGELOG.md index ed4234a..ad4cbd9 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,9 @@ # Changelog +## 1.8.3 + +- Fix issue with ESLint's Flat Config + ## 1.7.3 - Updated Biome to 1.7.3; added the following disables: diff --git a/index.js b/index.js index 018489d..fd3d7c5 100644 --- a/index.js +++ b/index.js @@ -4,8 +4,8 @@ * These are ESLint rules that have corresponding and recommended Biome rules. */ module.exports = { - extends: ["./eslint-config-prettier.js"], rules: { + ...require("./eslint-config-prettier.js").rules, "constructor-super": "off", "default-case-last": "off", "default-param-last": "off", diff --git a/package.json b/package.json index 962faf5..3635af6 100644 --- a/package.json +++ b/package.json @@ -1,14 +1,14 @@ { "name": "eslint-config-biome", - "version": "1.7.3", + "version": "1.8.3", "description": "Disables ESLint rules that have a recommended and equivalent Biome rule", "main": "index.js", "scripts": { "format": "biome check --apply-unsafe . && eslint --fix . package.json", "format:check": "biome check . && eslint . package.json", "pre-commit": "bun format && bun typecheck && bun test && git add -A", - "prepare": "husky install", - "start": "bun run scripts/index.ts", + "prepare": "husky", + "start": "bun i && bun run scripts/index.ts", "test:watch": "bun test --watch", "tsw": "tsc --watch --noEmit", "typecheck": "tsc --noEmit", @@ -33,13 +33,13 @@ ], "repository": "SrBrahma/eslint-config-biome", "devDependencies": { - "@biomejs/biome": "^1.7.3", - "@sindresorhus/tsconfig": "^5.0.0", - "@types/bun": "^1.1.3", - "@types/jsdom": "^21.1.6", + "@biomejs/biome": "^1.8.3", + "@sindresorhus/tsconfig": "^5.1.1", + "@types/bun": "^1.1.8", + "@types/jsdom": "^21.1.7", "eslint-config-gev": "4.5.1", - "husky": "^9.0.11", - "jsdom": "^24.1.0", - "typescript": "^5.4.5" + "husky": "^9.1.5", + "jsdom": "^24.1.3", + "typescript": "^5.5.4" } } diff --git a/scripts/index.test.ts b/scripts/index.test.ts index ee6a37a..53932f3 100644 --- a/scripts/index.test.ts +++ b/scripts/index.test.ts @@ -8,12 +8,16 @@ import { spawnSync } from "bun" const rootPath = path.resolve(__dirname, "..") const indexPath = path.resolve(rootPath, "index.js") const prettierPath = path.resolve(rootPath, "eslint-config-prettier.js") -const indexContent = fs.readFileSync(indexPath, "utf-8") const disabledRules = Object.keys( (require(indexPath) as { rules: Record }).rules, ) const prettierContent = fs.readFileSync(prettierPath, "utf-8") +// @ts-expect-error +import prettierJs from "../eslint-config-prettier.js" +// @ts-expect-error +import indexJs from "../eslint-config-prettier.js" + test("index.js is a valid file and can be used by eslint", () => { // In the root there is a .eslintrc that uses the index.js in the extends. expect( @@ -47,8 +51,13 @@ test("TS extensions should be added to index.js", () => { }) test("eslint-config-prettier is used and is valid", () => { - expect(indexContent).toContain('extends: ["./eslint-config-prettier.js"],') expect(prettierContent).toContain('"react/jsx-indent": "off"') + expect((prettierJs as { rules: Record }).rules).toContainKey( + "react/jsx-indent", + ) + expect((indexJs as { rules: Record }).rules).toContainKey( + "react/jsx-indent", + ) }) test("doesnt include clippy rules", () => { diff --git a/scripts/index.ts b/scripts/index.ts index 13341c0..537c0aa 100644 --- a/scripts/index.ts +++ b/scripts/index.ts @@ -5,7 +5,7 @@ import { getEquivalentRulesFromDocs } from "./fetchFromDocs" import { getEslintEquivalentRulesFromGithub } from "./fetchFromGithub.js" import { createPrettierFile } from "./prettier" import { getJsBaseRules, getTsExtensionsForRules } from "./tsExtensions" -import { sortRules, writeFile } from "./utils" +import { sortRules, writeMainFile } from "./utils" const main = async () => { const rules = [ @@ -22,7 +22,7 @@ const main = async () => { const rulesNoDuplicates = [...new Set(rulesWithTsExtends)] - writeFile(sortRules(rulesNoDuplicates)) + writeMainFile(sortRules(rulesNoDuplicates)) await createPrettierFile() console.log(`Generated ${filenames.index} & ${filenames.prettier}!`) diff --git a/scripts/utils.ts b/scripts/utils.ts index 3c161da..d8de728 100644 --- a/scripts/utils.ts +++ b/scripts/utils.ts @@ -31,7 +31,7 @@ export const sortRules = (rules: Array) => return a.localeCompare(b) }) -export const writeFile = (rules: Array) => { +export const writeMainFile = (rules: Array) => { fs.writeFileSync( filenames.index, `/** @@ -40,8 +40,8 @@ export const writeFile = (rules: Array) => { * These are ESLint rules that have corresponding and recommended Biome rules. */ module.exports = { - extends: ["./${filenames.prettier}"], rules: { + ...require("./eslint-config-prettier.js").rules, ${rules.map((rule) => ` "${rule}": "off",`).join("\n")} } }