diff --git a/.eslintignore b/.eslintignore deleted file mode 100644 index a3e906649..000000000 --- a/.eslintignore +++ /dev/null @@ -1,2 +0,0 @@ -node_modules -.eslintrc.js \ No newline at end of file diff --git a/.eslintrc.js b/.eslintrc.js deleted file mode 100644 index f6b7e5722..000000000 --- a/.eslintrc.js +++ /dev/null @@ -1,42 +0,0 @@ -module.exports = { - root: true, - parser: '@typescript-eslint/parser', - env: { - browser: true, - amd: true, - node: true, - es6: true, - }, - plugins: ['@typescript-eslint'], - extends: [ - 'eslint:recommended', - 'plugin:@typescript-eslint/eslint-recommended', - 'plugin:@typescript-eslint/recommended', - 'plugin:jsx-a11y/recommended', - 'plugin:prettier/recommended', - 'next', - 'next/core-web-vitals', - ], - 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': 0, - '@typescript-eslint/no-unused-vars': 0, - 'react/no-unescaped-entities': 0, - '@typescript-eslint/explicit-module-boundary-types': 'off', - '@typescript-eslint/no-var-requires': 'off', - '@typescript-eslint/ban-ts-comment': 'off', - }, -} diff --git a/eslint.config.mjs b/eslint.config.mjs new file mode 100644 index 000000000..94fc407be --- /dev/null +++ b/eslint.config.mjs @@ -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', + }, + }, +] diff --git a/layouts/ListLayoutWithTags.tsx b/layouts/ListLayoutWithTags.tsx index 4d32e466e..a7d21b5fc 100644 --- a/layouts/ListLayoutWithTags.tsx +++ b/layouts/ListLayoutWithTags.tsx @@ -1,4 +1,3 @@ -/* eslint-disable jsx-a11y/anchor-is-valid */ 'use client' import { usePathname } from 'next/navigation' diff --git a/next-env.d.ts b/next-env.d.ts index 4f11a03dc..40c3d6809 100644 --- a/next-env.d.ts +++ b/next-env.d.ts @@ -2,4 +2,4 @@ /// // 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. diff --git a/package.json b/package.json index 58c6f9c83..81c329075 100644 --- a/package.json +++ b/package.json @@ -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", @@ -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", diff --git a/yarn.lock b/yarn.lock index a04590349..c5f5a45ec 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2116,6 +2116,23 @@ __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" @@ -2123,6 +2140,13 @@ __metadata: 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" @@ -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" @@ -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 @@ -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