Skip to content

Commit

Permalink
1.8.3
Browse files Browse the repository at this point in the history
  • Loading branch information
SrBrahma committed Sep 7, 2024
1 parent b8009d6 commit b69ccd7
Show file tree
Hide file tree
Showing 9 changed files with 30 additions and 28 deletions.
4 changes: 0 additions & 4 deletions .husky/post-checkout

This file was deleted.

4 changes: 0 additions & 4 deletions .husky/post-merge

This file was deleted.

3 changes: 0 additions & 3 deletions .husky/pre-commit
Original file line number Diff line number Diff line change
@@ -1,4 +1 @@
#!/usr/bin/env sh
. "$(dirname -- "$0")/_/husky.sh"

bun pre-commit
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -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:
Expand Down
2 changes: 1 addition & 1 deletion index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
20 changes: 10 additions & 10 deletions package.json
Original file line number Diff line number Diff line change
@@ -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",
Expand All @@ -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"
}
}
13 changes: 11 additions & 2 deletions scripts/index.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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<string, string> }).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(
Expand Down Expand Up @@ -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<string, unknown> }).rules).toContainKey(
"react/jsx-indent",
)
expect((indexJs as { rules: Record<string, unknown> }).rules).toContainKey(
"react/jsx-indent",
)
})

test("doesnt include clippy rules", () => {
Expand Down
4 changes: 2 additions & 2 deletions scripts/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 = [
Expand All @@ -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}!`)
Expand Down
4 changes: 2 additions & 2 deletions scripts/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ export const sortRules = (rules: Array<string>) =>
return a.localeCompare(b)
})

export const writeFile = (rules: Array<string>) => {
export const writeMainFile = (rules: Array<string>) => {
fs.writeFileSync(
filenames.index,
`/**
Expand All @@ -40,8 +40,8 @@ export const writeFile = (rules: Array<string>) => {
* 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")}
}
}
Expand Down

0 comments on commit b69ccd7

Please sign in to comment.