Skip to content

Commit

Permalink
chore(lint): migrate from biome to eslint for linting
Browse files Browse the repository at this point in the history
  • Loading branch information
kuizuo committed Jan 18, 2025
1 parent 440235b commit 92eb1df
Show file tree
Hide file tree
Showing 38 changed files with 653 additions and 539 deletions.
66 changes: 45 additions & 21 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -1,26 +1,50 @@
{
// Disable the default formatter, use eslint instead
"prettier.enable": false,
"editor.formatOnSave": false,

// Auto fix
"editor.codeActionsOnSave": {
"quickfix.biome": "explicit",
"source.organizeImports": "explicit"
"source.fixAll.eslint": "explicit",
"source.organizeImports": "never"
},
"editor.defaultFormatter": "biomejs.biome",
"[markdown]": {
"editor.formatOnSave": false
},
"tailwindCSS.experimental.classRegex": [
["cva\\(([^)]*)\\)", "[\"'`]([^\"'`]*).*?[\"'`]"],
["cn\\(([^)]*)\\)", "[\"'`]([^\"'`]*).*?[\"'`]"]

// Silent the stylistic rules in you IDE, but still auto fix them
"eslint.rules.customizations": [
{ "rule": "style/*", "severity": "off", "fixable": true },
{ "rule": "format/*", "severity": "off", "fixable": true },
{ "rule": "*-indent", "severity": "off", "fixable": true },
{ "rule": "*-spacing", "severity": "off", "fixable": true },
{ "rule": "*-spaces", "severity": "off", "fixable": true },
{ "rule": "*-order", "severity": "off", "fixable": true },
{ "rule": "*-dangle", "severity": "off", "fixable": true },
{ "rule": "*-newline", "severity": "off", "fixable": true },
{ "rule": "*quotes", "severity": "off", "fixable": true },
{ "rule": "*semi", "severity": "off", "fixable": true }
],
"[tailwindcss]": {
"editor.defaultFormatter": "esbenp.prettier-vscode"
},
"[typescriptreact]": {
"editor.defaultFormatter": "biomejs.biome"
},
"[javascript]": {
"editor.defaultFormatter": "biomejs.biome"
},
"[typescript]": {
"editor.defaultFormatter": "biomejs.biome"
}

// Enable eslint for all supported languages
"eslint.validate": [
"javascript",
"javascriptreact",
"typescript",
"typescriptreact",
"vue",
"html",
"markdown",
"json",
"jsonc",
"yaml",
"toml",
"xml",
"gql",
"graphql",
"astro",
"svelte",
"css",
"less",
"scss",
"pcss",
"postcss"
]
}
99 changes: 0 additions & 99 deletions biome.json

This file was deleted.

8 changes: 4 additions & 4 deletions data/features.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@ const FEATURES: FeatureItem[] = [
作为一名 TypeScript 全栈工程师,秉着能用 TS 绝不用 JS 的原则,为项目提供类型安全的保障,提高代码质量和开发效率。
</Translate>
),
header: <WebDeveloperSvg className={'h-auto w-full'} height={150} role="img" />,
icon: <Icon icon="logos:typescript-icon" className="h-4 w-4 text-neutral-500" />,
header: <WebDeveloperSvg className="h-auto w-full" height={150} role="img" />,
icon: <Icon icon="logos:typescript-icon" className="size-4 text-neutral-500" />,
},
{
title: translate({
Expand All @@ -35,7 +35,7 @@ const FEATURES: FeatureItem[] = [
作为一名曾学习与实践逆向工程两年半的开发者,对于逆向工程有着浓厚的兴趣,同时造就了超凡的阅读代码能力。没有看不懂的代码,只有不想看的代码。
</Translate>
),
header: <SpiderSvg className={'h-auto w-full'} height={150} role="img" />,
header: <SpiderSvg className="h-auto w-full" height={150} role="img" />,
},
{
title: translate({
Expand All @@ -47,7 +47,7 @@ const FEATURES: FeatureItem[] = [
作为一名开源爱好者,积极参与开源社区,为开源项目贡献代码,希望有生之年能够构建出一个知名的开源项目。
</Translate>
),
header: <OpenSourceSvg className={'h-auto w-full'} height={150} role="img" />,
header: <OpenSourceSvg className="h-auto w-full" height={150} role="img" />,
},
]

Expand Down
2 changes: 1 addition & 1 deletion data/resources.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ export interface ResourceCategory {
resources: Resource[]
}

const friends: Resource[] = Friends.map(f => {
const friends: Resource[] = Friends.map((f) => {
return {
...f,
name: f.title,
Expand Down
29 changes: 29 additions & 0 deletions eslint.config.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
import stylistic from '@stylistic/eslint-plugin'
import reactPlugin from 'eslint-plugin-react'
import tailwind from 'eslint-plugin-tailwindcss'
import ts from 'typescript-eslint'

export default [
{
ignores: ['.docusaurus', 'build'],
},
stylistic.configs['recommended-flat'],
...ts.configs.recommended,
...tailwind.configs['flat/recommended'],
{
files: ['**/*.ts', '**/*.tsx'],
plugins: {
react: reactPlugin,
},
rules: {
...reactPlugin.configs['jsx-runtime'].rules,

'@typescript-eslint/no-unused-vars': 'off',
'@typescript-eslint/no-require-imports': 'off',
'@typescript-eslint/no-empty-object-type': 'off',
'@typescript-eslint/no-explicit-any': 'off',

'tailwindcss/no-custom-classname': 'off',
},
},
]
11 changes: 7 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,8 @@
"deploy": "docusaurus deploy",
"clear": "docusaurus clear && rimraf changelog",
"serve": "docusaurus serve",
"format": "biome format --write ./src",
"lint": "biome check ./src",
"lint:fix": "biome check --write --unsafe ./src",
"lint": "eslint .",
"lint:fix": "eslint . --fix",
"write-translations": "docusaurus write-translations",
"write-heading-ids": "docusaurus write-heading-ids",
"index": "docker run -it --env-file=.env -e \"CONFIG=$(cat docsearch.json | jq -r tostring)\" algolia/docsearch-scraper"
Expand Down Expand Up @@ -58,12 +57,16 @@
"tailwindcss": "^3.4.17"
},
"devDependencies": {
"@biomejs/biome": "1.9.4",
"@docusaurus/module-type-aliases": "3.7.0",
"@docusaurus/tsconfig": "^3.7.0",
"@docusaurus/types": "3.7.0",
"@iconify/react": "^5.2.0",
"@stylistic/eslint-plugin": "2.13.0",
"@tailwindcss/typography": "^0.5.16",
"@typescript-eslint/eslint-plugin": "8.20.0",
"eslint": "9.18.0",
"eslint-plugin-tailwindcss": "3.18.0",
"eslint-plugin-turbo": "2.3.3",
"typescript": "~5.7.3"
},
"engines": {
Expand Down
Loading

0 comments on commit 92eb1df

Please sign in to comment.