Skip to content

Commit

Permalink
Merge pull request #1065 from elonzh/feat/migrate-eslint-config
Browse files Browse the repository at this point in the history
migrate eslintrc to eslint.config.mjs
  • Loading branch information
timlrx authored Dec 4, 2024
2 parents 912484a + 747ba30 commit 6e1b3a1
Show file tree
Hide file tree
Showing 7 changed files with 108 additions and 46 deletions.
2 changes: 0 additions & 2 deletions .eslintignore

This file was deleted.

42 changes: 0 additions & 42 deletions .eslintrc.js

This file was deleted.

70 changes: 70 additions & 0 deletions eslint.config.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
import typescriptEslint from '@typescript-eslint/eslint-plugin'
import globals from 'globals'
import tsParser from '@typescript-eslint/parser'
import path from 'node:path'
import { fileURLToPath } from 'node:url'
import js from '@eslint/js'
import { FlatCompat } from '@eslint/eslintrc'

const __filename = fileURLToPath(import.meta.url)
const __dirname = path.dirname(__filename)
const compat = new FlatCompat({
baseDirectory: __dirname,
})

export default [
{
ignores: [],
},
js.configs.recommended,
...compat.extends(
'plugin:@typescript-eslint/eslint-recommended',
'plugin:@typescript-eslint/recommended',
'plugin:jsx-a11y/recommended',
'plugin:prettier/recommended',
'next',
'next/core-web-vitals'
),
{
plugins: {
'@typescript-eslint': typescriptEslint,
},

languageOptions: {
globals: {
...globals.browser,
...globals.amd,
...globals.node,
},

parser: tsParser,
ecmaVersion: 5,
sourceType: 'commonjs',

parserOptions: {
project: true,
tsconfigRootDir: __dirname,
},
},

rules: {
'prettier/prettier': 'error',
'react/react-in-jsx-scope': 'off',

'jsx-a11y/anchor-is-valid': [
'error',
{
components: ['Link'],
specialLink: ['hrefLeft', 'hrefRight'],
aspects: ['invalidHref', 'preferButton'],
},
],
'react/prop-types': 'off',
'@typescript-eslint/no-unused-vars': 'off',
'react/no-unescaped-entities': 'off',
'@typescript-eslint/explicit-module-boundary-types': 'off',
'@typescript-eslint/no-var-requires': 'off',
'@typescript-eslint/ban-ts-comment': 'off',
},
},
]
1 change: 0 additions & 1 deletion layouts/ListLayoutWithTags.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
/* eslint-disable jsx-a11y/anchor-is-valid */
'use client'

import { usePathname } from 'next/navigation'
Expand Down
2 changes: 1 addition & 1 deletion next-env.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@
/// <reference types="next/image-types/global" />

// NOTE: This file should not be edited
// see https://nextjs.org/docs/basic-features/typescript for more information.
// see https://nextjs.org/docs/app/building-your-application/configuring/typescript for more information.
3 changes: 3 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,8 @@
"unist-util-visit": "^5.0.0"
},
"devDependencies": {
"@eslint/eslintrc": "^3.2.0",
"@eslint/js": "^9.16.0",
"@svgr/webpack": "^8.0.1",
"@types/mdx": "^2.0.12",
"@types/react": "^18.2.73",
Expand All @@ -57,6 +59,7 @@
"eslint-config-next": "15.0.2",
"eslint-config-prettier": "^9.1.0",
"eslint-plugin-prettier": "^5.2.0",
"globals": "^15.12.0",
"husky": "^9.0.0",
"lint-staged": "^13.0.0",
"prettier": "^3.0.0",
Expand Down
34 changes: 34 additions & 0 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -2116,13 +2116,37 @@ __metadata:
languageName: node
linkType: hard

"@eslint/eslintrc@npm:^3.2.0":
version: 3.2.0
resolution: "@eslint/eslintrc@npm:3.2.0"
dependencies:
ajv: ^6.12.4
debug: ^4.3.2
espree: ^10.0.1
globals: ^14.0.0
ignore: ^5.2.0
import-fresh: ^3.2.1
js-yaml: ^4.1.0
minimatch: ^3.1.2
strip-json-comments: ^3.1.1
checksum: c898e4d12f4c9a79a61ee3c91e38eea5627a04e021cb749191e8537445858bfe32f810eca0cb2dc9902b8ad8b65ca07ef7221dc4bad52afe60cbbf50ec56c236
languageName: node
linkType: hard

"@eslint/js@npm:9.14.0":
version: 9.14.0
resolution: "@eslint/js@npm:9.14.0"
checksum: 727767d3c80bf88e08565af10cc3732ca0d272c729bbd39043722a203eea289ec6149ab42d977d2d28a81d99329dceeed091b70db37b868e6659913a0840e17b
languageName: node
linkType: hard

"@eslint/js@npm:^9.16.0":
version: 9.16.0
resolution: "@eslint/js@npm:9.16.0"
checksum: ba2d7f7266df827df72cec069df9284ad5e7edb4894a8c58c41db0d489136b22815dc76cd34cf565284979feb4d3a8197b511e08529c03f30c80b5235d25030b
languageName: node
linkType: hard

"@eslint/object-schema@npm:^2.1.4":
version: 2.1.4
resolution: "@eslint/object-schema@npm:2.1.4"
Expand Down Expand Up @@ -6362,6 +6386,13 @@ __metadata:
languageName: node
linkType: hard

"globals@npm:^15.12.0":
version: 15.12.0
resolution: "globals@npm:15.12.0"
checksum: 2a134cc876dd73192489561e3c85be348dc1408fef043ebef605cdc437f64cd2fc922268db02e3348683d05d06bed10fb1c3653b3d4399a204a7ecd59e742a07
languageName: node
linkType: hard

"globalthis@npm:^1.0.3, globalthis@npm:^1.0.4":
version: 1.0.4
resolution: "globalthis@npm:1.0.4"
Expand Down Expand Up @@ -11320,6 +11351,8 @@ react@rc:
version: 0.0.0-use.local
resolution: "tailwind-nextjs-starter-blog@workspace:."
dependencies:
"@eslint/eslintrc": ^3.2.0
"@eslint/js": ^9.16.0
"@headlessui/react": 2.2.0
"@next/bundle-analyzer": 15.0.2
"@svgr/webpack": ^8.0.1
Expand All @@ -11339,6 +11372,7 @@ react@rc:
eslint-config-prettier: ^9.1.0
eslint-plugin-prettier: ^5.2.0
github-slugger: ^2.0.0
globals: ^15.12.0
gray-matter: ^4.0.2
hast-util-from-html-isomorphic: ^2.0.0
husky: ^9.0.0
Expand Down

0 comments on commit 6e1b3a1

Please sign in to comment.