diff --git a/.eslintignore b/.eslintignore deleted file mode 100644 index 4a44329..0000000 --- a/.eslintignore +++ /dev/null @@ -1,386 +0,0 @@ -# Created by https://www.toptal.com/developers/gitignore/api/images,linux,macos,node,sublimetext,vim,visualstudiocode,windows,yarn -# Edit at https://www.toptal.com/developers/gitignore?templates=images,linux,macos,node,sublimetext,vim,visualstudiocode,windows,yarn - -### Images ### -# JPEG -*.jpg -*.jpeg -*.jpe -*.jif -*.jfif -*.jfi - -# JPEG 2000 -*.jp2 -*.j2k -*.jpf -*.jpx -*.jpm -*.mj2 - -# JPEG XR -*.jxr -*.hdp -*.wdp - -# Graphics Interchange Format -*.gif - -# RAW -*.raw - -# Web P -*.webp - -# Portable Network Graphics -*.png - -# Animated Portable Network Graphics -*.apng - -# Multiple-image Network Graphics -*.mng - -# Tagged Image File Format -*.tiff -*.tif - -# Scalable Vector Graphics -*.svg -*.svgz - -# Portable Document Format -*.pdf - -# X BitMap -*.xbm - -# BMP -*.bmp -*.dib - -# ICO -*.ico - -# 3D Images -*.3dm -*.max - -### Linux ### -*~ - -# temporary files which can be created if a process still has a handle open of a deleted file -.fuse_hidden* - -# KDE directory preferences -.directory - -# Linux trash folder which might appear on any partition or disk -.Trash-* - -# .nfs files are created when an open file is removed but is still being accessed -.nfs* - -### macOS ### -# General -.DS_Store -.AppleDouble -.LSOverride - -# Icon must end with two \r -Icon - - -# Thumbnails -._* - -# Files that might appear in the root of a volume -.DocumentRevisions-V100 -.fseventsd -.Spotlight-V100 -.TemporaryItems -.Trashes -.VolumeIcon.icns -.com.apple.timemachine.donotpresent - -# Directories potentially created on remote AFP share -.AppleDB -.AppleDesktop -Network Trash Folder -Temporary Items -.apdisk - -### macOS Patch ### -# iCloud generated files -*.icloud - -### Node ### -# Logs -logs -*.log -npm-debug.log* -yarn-debug.log* -yarn-error.log* -lerna-debug.log* -.pnpm-debug.log* - -# Diagnostic reports (https://nodejs.org/api/report.html) -report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json - -# Runtime data -pids -*.pid -*.seed -*.pid.lock - -# Directory for instrumented libs generated by jscoverage/JSCover -lib-cov - -# Coverage directory used by tools like istanbul -coverage -*.lcov - -# nyc test coverage -.nyc_output - -# Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files) -.grunt - -# Bower dependency directory (https://bower.io/) -bower_components - -# node-waf configuration -.lock-wscript - -# Compiled binary addons (https://nodejs.org/api/addons.html) -build/Release - -# Dependency directories -node_modules/ -jspm_packages/ - -# Snowpack dependency directory (https://snowpack.dev/) -web_modules/ - -# TypeScript cache -*.tsbuildinfo - -# Optional npm cache directory -.npm - -# Optional eslint cache -.eslintcache - -# Optional stylelint cache -.stylelintcache - -# Microbundle cache -.rpt2_cache/ -.rts2_cache_cjs/ -.rts2_cache_es/ -.rts2_cache_umd/ - -# Optional REPL history -.node_repl_history - -# Output of 'npm pack' -*.tgz - -# Yarn Integrity file -.yarn-integrity - -# dotenv environment variable files -.env -.env.development.local -.env.test.local -.env.production.local -.env.local - -# parcel-bundler cache (https://parceljs.org/) -.cache -.parcel-cache - -# Next.js build output -.next -out - -# Nuxt.js build / generate output -.nuxt -dist - -# Gatsby files -.cache/ -# Comment in the public line in if your project uses Gatsby and not Next.js -# https://nextjs.org/blog/next-9-1#public-directory-support -public - -# vuepress build output -.vuepress/dist - -# vuepress v2.x temp and cache directory -.temp - -# Docusaurus cache and generated files -.docusaurus - -# Serverless directories -.serverless/ - -# FuseBox cache -.fusebox/ - -# DynamoDB Local files -.dynamodb/ - -# TernJS port file -.tern-port - -# Stores VSCode versions used for testing VSCode extensions -.vscode-test - -# yarn v2 -.yarn/cache -.yarn/unplugged -.yarn/build-state.yml -.yarn/install-state.gz -.pnp.* - -### Node Patch ### -# Serverless Webpack directories -.webpack/ - -# Optional stylelint cache - -# SvelteKit build / generate output -.svelte-kit - -### SublimeText ### -# Cache files for Sublime Text -*.tmlanguage.cache -*.tmPreferences.cache -*.stTheme.cache - -# Workspace files are user-specific -*.sublime-workspace - -# Project files should be checked into the repository, unless a significant -# proportion of contributors will probably not be using Sublime Text -*.sublime-project - -# SFTP configuration file -sftp-config.json -sftp-config-alt*.json - -# Package control specific files -Package Control.last-run -Package Control.ca-list -Package Control.ca-bundle -Package Control.system-ca-bundle -Package Control.cache/ -Package Control.ca-certs/ -Package Control.merged-ca-bundle -Package Control.user-ca-bundle -oscrypto-ca-bundle.crt -bh_unicode_properties.cache - -# Sublime-github package stores a github token in this file -# https://packagecontrol.io/packages/sublime-github -GitHub.sublime-settings - -### Vim ### -# Swap -[._]*.s[a-v][a-z] -!*.svg # comment out if you don't need vector files -[._]*.sw[a-p] -[._]s[a-rt-v][a-z] -[._]ss[a-gi-z] -[._]sw[a-p] - -# Session -Session.vim -Sessionx.vim - -# Temporary -.netrwhist -# Auto-generated tag files -tags -# Persistent undo -[._]*.un~ - -### VisualStudioCode ### -.vscode/* -!.vscode/settings.json -!.vscode/tasks.json -!.vscode/launch.json -!.vscode/extensions.json -!.vscode/*.code-snippets - -# Local History for Visual Studio Code -.history/ - -# Built Visual Studio Code Extensions -*.vsix - -### VisualStudioCode Patch ### -# Ignore all local history of files -.history -.ionide - -### Windows ### -# Windows thumbnail cache files -Thumbs.db -Thumbs.db:encryptable -ehthumbs.db -ehthumbs_vista.db - -# Dump file -*.stackdump - -# Folder config file -[Dd]esktop.ini - -# Recycle Bin used on file shares -$RECYCLE.BIN/ - -# Windows Installer files -*.cab -*.msi -*.msix -*.msm -*.msp - -# Windows shortcuts -*.lnk - -### yarn ### -# https://yarnpkg.com/getting-started/qa#which-files-should-be-gitignored - -.yarn/* -!.yarn/releases -!.yarn/patches -!.yarn/plugins -!.yarn/sdks -!.yarn/versions - -# if you are NOT using Zero-installs, then: -# comment the following lines -# !.yarn/cache - -# and uncomment the following lines -.pnp.* - -# End of https://www.toptal.com/developers/gitignore/api/images,linux,macos,node,sublimetext,vim,visualstudiocode,windows,yarn - -### THE PROJECT SPECIFIES ################################################# - -### Node ### -# JSON -*.json - -# yarn v2 -.yarn/ -yarn.lock - -### Text ### -*.md -LICENSE diff --git a/.eslintrc.yml b/.eslintrc.yml deleted file mode 100644 index 7fb0c66..0000000 --- a/.eslintrc.yml +++ /dev/null @@ -1,7 +0,0 @@ -extends: - - '@kurone-kito/eslint-config-base/.eslintrc.yml' -parserOptions: - project: - - './tsconfig.json' - - packages/*/tsconfig.json -root: true diff --git a/.vscode/settings.json b/.vscode/settings.json index 7321c34..ca116cb 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -6,7 +6,6 @@ "*.d.mts": "${capture}.d.mts*, ${capture}.mjs*", "*.md": "${capture}.*.md", "*.yml": "${capture}.json", - ".eslintrc*": ".eslintignore", ".gitattributes": ".gitignore", ".markdownlint.*": ".markdownlint-cli2.*", ".pnp.loader.mjs": ".pnp.cjs", diff --git a/.yarn/sdks/eslint/package.json b/.yarn/sdks/eslint/package.json index 263cd3d..79cc06a 100644 --- a/.yarn/sdks/eslint/package.json +++ b/.yarn/sdks/eslint/package.json @@ -1,6 +1,6 @@ { "name": "eslint", - "version": "8.57.0-sdk", + "version": "9.7.0-sdk", "main": "./lib/api.js", "type": "commonjs", "bin": { diff --git a/cspell.config.yml b/cspell.config.yml index abf8fd5..f1fa540 100644 --- a/cspell.config.yml +++ b/cspell.config.yml @@ -7,3 +7,5 @@ import: - '@kurone-kito/cspell-config' usePnP: true version: '0.2' +words: + - TSES diff --git a/eslint.config.mjs b/eslint.config.mjs new file mode 100644 index 0000000..2b213d4 --- /dev/null +++ b/eslint.config.mjs @@ -0,0 +1 @@ +export { default } from '@kurone-kito/eslint-config-base'; diff --git a/package.json b/package.json index 75ec110..34a6a98 100644 --- a/package.json +++ b/package.json @@ -53,7 +53,6 @@ "@commitlint/cli": "^19.3.0", "@commitlint/config-conventional": "^19.2.2", "@cspell/cspell-types": "^8.12.1", - "@cspell/eslint-plugin": "^8.12.1", "@kurone-kito/commitlint-config": "workspace:^", "@kurone-kito/cspell-config": "workspace:^", "@kurone-kito/eslint-config-base": "workspace:^", @@ -62,27 +61,13 @@ "@kurone-kito/markdownlint-config": "workspace:^", "@kurone-kito/prettier-config": "workspace:^", "@kurone-kito/typescript-config": "workspace:^", - "@typescript-eslint/eslint-plugin": "^7.17.0", + "@types/eslint": "^9.6.0", "@typescript-eslint/parser": "^7.17.0", "@yarnpkg/sdks": "^3.1.3", "concurrently": "^8.2.2", "cspell": "^8.12.1", - "eslint": "^8.57.0", - "eslint-config-airbnb-typescript": "^18.0.0", - "eslint-config-prettier": "^9.1.0", + "eslint": "^9.7.0", "eslint-formatter-codeframe": "^7.32.1", - "eslint-import-resolver-node": "^0.3.9", - "eslint-import-resolver-typescript": "^3.6.1", - "eslint-plugin-editorconfig": "^4.0.3", - "eslint-plugin-import": "^2.29.1", - "eslint-plugin-jsdoc": "^48.8.3", - "eslint-plugin-json": "^4.0.0", - "eslint-plugin-markdown": "^5.1.0", - "eslint-plugin-markdownlint": "^0.6.0", - "eslint-plugin-n": "^17.9.0", - "eslint-plugin-oxlint": "^0.5.0", - "eslint-plugin-react": "^7.35.0", - "eslint-plugin-yaml": "^1.0.3", "husky": "^9.1.1", "lint-staged": "^15.2.7", "markdownlint-cli2": "^0.13.0", diff --git a/packages/eslint-config-base/README.md b/packages/eslint-config-base/README.md index 43767a6..09624ec 100644 --- a/packages/eslint-config-base/README.md +++ b/packages/eslint-config-base/README.md @@ -4,29 +4,39 @@ My ESLint configuration for general Node.js projects. ## Usage +### Use the flat config (recommended) + +First, install this package and its peer dependencies: + +```sh +npm install --save-dev @kurone-kito/eslint-config-base eslint +``` + +Then, create a `eslint.config.mjs` file. +If exists, merge the following configuration into it: + +```js +export { default } from '@kurone-kito/eslint-config-base'; +``` + +### for legacy configuration (deprecated) + +⚠️ **DEPRECATED**: The legacy configuration is no longer maintained. + First, install this package and its peer dependencies: ```sh npm install --save-dev \ @kurone-kito/eslint-config-base \ @cspell/eslint-plugin \ - @typescript-eslint/eslint-plugin \ - @typescript-eslint/parser \ eslint \ eslint-config-airbnb-typescript \ - eslint-config-prettier \ - eslint-formatter-codeframe \ eslint-import-resolver-node \ eslint-import-resolver-typescript \ eslint-plugin-editorconfig \ eslint-plugin-import \ - eslint-plugin-jsdoc \ - eslint-plugin-json \ - eslint-plugin-markdown \ eslint-plugin-markdownlint \ - eslint-plugin-n \ - eslint-plugin-oxlint \ - eslint-plugin-yaml + eslint-plugin-n ``` Then, create a `.eslintrc.yml` file. diff --git a/packages/eslint-config-base/package.json b/packages/eslint-config-base/package.json index d1ae6b9..3fde5ca 100644 --- a/packages/eslint-config-base/package.json +++ b/packages/eslint-config-base/package.json @@ -39,18 +39,16 @@ "prepack": "conc -m 1 \"yarn:clean\" \"yarn:build\"", "start": "tsc --watch" }, - "devDependencies": { + "dependencies": { "@cspell/eslint-plugin": "^8.12.1", - "@kurone-kito/typescript-config": "workspace:^", - "@types/eslint": "^8.56.11", + "@eslint/compat": "^1.1.1", + "@eslint/eslintrc": "^3.1.0", + "@eslint/js": "^9.7.0", "@typescript-eslint/eslint-plugin": "^7.17.0", "@typescript-eslint/parser": "^7.17.0", - "concurrently": "^8.2.2", - "cpy-cli": "^5.0.0", - "eslint": "^8.57.0", + "eslint-config-airbnb-base": "^15.0.0", "eslint-config-airbnb-typescript": "^18.0.0", "eslint-config-prettier": "^9.1.0", - "eslint-formatter-codeframe": "^7.32.1", "eslint-import-resolver-node": "^0.3.9", "eslint-import-resolver-typescript": "^3.6.1", "eslint-plugin-editorconfig": "^4.0.3", @@ -62,85 +60,31 @@ "eslint-plugin-n": "^17.9.0", "eslint-plugin-oxlint": "^0.5.0", "eslint-plugin-yaml": "^1.0.3", + "typescript-eslint": "^7.17.0" + }, + "devDependencies": { + "@kurone-kito/typescript-config": "workspace:^", + "@types/eslint": "^9.6.0", + "@types/eslint-config-prettier": "^6.11.3", + "@types/eslint-plugin-markdown": "^2.0.2", + "@types/eslint__eslintrc": "^2.1.2", + "@types/eslint__js": "^8.42.3", + "@types/node": "^20.14.12", + "@typescript-eslint/utils": "^7.17.0", + "concurrently": "^8.2.2", + "cpy-cli": "^5.0.0", + "eslint": "^9.7.0", + "eslint-formatter-codeframe": "^7.32.1", "js-yaml": "^4.1.0", - "prettier": "^3.3.3", "rimraf": "^5.0.9", "typescript": "~5.5.4" }, "peerDependencies": { - "@cspell/eslint-plugin": ">=6.x.x", - "@typescript-eslint/eslint-plugin": ">=6.0.x", - "@typescript-eslint/parser": ">=6.0.x", - "eslint": ">=8.2.x", - "eslint-config-airbnb-typescript": ">=17.x.x", - "eslint-config-prettier": ">=8.x.x", - "eslint-formatter-codeframe": ">=7.x.x", - "eslint-import-resolver-node": ">=0.3.x", - "eslint-import-resolver-typescript": ">=3.x.x", - "eslint-plugin-editorconfig": ">=4.x.x", - "eslint-plugin-import": ">=2.27.x", - "eslint-plugin-jsdoc": ">=46.x.x", - "eslint-plugin-json": ">=4.x.x", - "eslint-plugin-markdown": ">=3.x.x", - "eslint-plugin-markdownlint": ">=0.5.x", - "eslint-plugin-n": ">=17.x.x", - "eslint-plugin-oxlint": ">=0.2.x", - "eslint-plugin-yaml": ">=0.5.x" + "eslint": ">=9.x.x" }, "peerDependenciesMeta": { - "@cspell/eslint-plugin": { - "optional": true - }, - "@typescript-eslint/eslint-plugin": { - "optional": true - }, - "@typescript-eslint/parser": { - "optional": true - }, "eslint": { "optional": true - }, - "eslint-config-airbnb-typescript": { - "optional": true - }, - "eslint-config-prettier": { - "optional": true - }, - "eslint-formatter-codeframe": { - "optional": true - }, - "eslint-import-resolver-node": { - "optional": true - }, - "eslint-import-resolver-typescript": { - "optional": true - }, - "eslint-plugin-editorconfig": { - "optional": true - }, - "eslint-plugin-import": { - "optional": true - }, - "eslint-plugin-jsdoc": { - "optional": true - }, - "eslint-plugin-json": { - "optional": true - }, - "eslint-plugin-markdown": { - "optional": true - }, - "eslint-plugin-markdownlint": { - "optional": true - }, - "eslint-plugin-n": { - "optional": true - }, - "eslint-plugin-oxlint": { - "optional": true - }, - "eslint-plugin-yaml": { - "optional": true } }, "engines": { diff --git a/packages/eslint-config-base/src/airbnb.mts b/packages/eslint-config-base/src/airbnb.mts new file mode 100644 index 0000000..2b168a4 --- /dev/null +++ b/packages/eslint-config-base/src/airbnb.mts @@ -0,0 +1,13 @@ +import type { Linter } from 'eslint'; +import { compat } from './utils.mjs'; + +/** The configuration for ESLint to use the Airbnb style guide. */ +export const airbnbConfig: readonly Linter.FlatConfig[] = [ + ...compat.extends('airbnb-base'), + ...compat.extends('airbnb-typescript/base'), + { + languageOptions: { + parserOptions: { project: true, tsconfigRootDir: process.cwd() }, + }, + }, +]; diff --git a/packages/eslint-config-base/src/data.mts b/packages/eslint-config-base/src/data.mts new file mode 100644 index 0000000..420ea80 --- /dev/null +++ b/packages/eslint-config-base/src/data.mts @@ -0,0 +1,10 @@ +import type { Linter } from 'eslint'; +// @ts-ignore +import json from 'eslint-plugin-json'; +import pluginYaml from 'eslint-plugin-yaml'; + +/** The ESLint configuration for data language files. */ +export const dataConfig: readonly Linter.FlatConfig[] = [ + { files: ['**/*.json'], ...json.configs['recommended'] }, + (pluginYaml as any).configs.recommended, +]; diff --git a/packages/eslint-config-base/src/ignore.mts b/packages/eslint-config-base/src/ignore.mts new file mode 100644 index 0000000..901807b --- /dev/null +++ b/packages/eslint-config-base/src/ignore.mts @@ -0,0 +1,13 @@ +import { existsSync } from 'node:fs'; +import { resolve } from 'node:path'; +import { includeIgnoreFile } from '@eslint/compat'; +import type { Linter } from 'eslint'; + +/** The path to the `.gitignore` file. */ +const gitignore = resolve(process.cwd(), '.gitignore'); + +/** The configuration for ESLint to ignore files and directories. */ +export const ignoreConfig: readonly Linter.FlatConfig[] = [ + ...(existsSync(gitignore) ? [includeIgnoreFile(gitignore)] : []), + { ignores: ['.yarn/**/*', 'yarn.lock'] }, +]; diff --git a/packages/eslint-config-base/src/import.mts b/packages/eslint-config-base/src/import.mts new file mode 100644 index 0000000..33ce453 --- /dev/null +++ b/packages/eslint-config-base/src/import.mts @@ -0,0 +1,107 @@ +import type { Linter } from 'eslint'; +import { compat } from './utils.mjs'; + +/** Additional configuration for the `import` plugin. */ +export const additionalImportConfig: readonly Linter.FlatConfig[] = [ + { + files: ['*.?(c)js?(x)'], + rules: { + /** + * Allow `require` syntax only for JavaScript. By default, it is + * completely prohibited. + * + * There are many situations where pure JavaScript is used outside + * the scope of transpiling, such as in various configuration files, + * making the `import` syntax challenging. + */ + '@typescript-eslint/no-var-requires': 'off', + }, + }, + { + files: ['*.?([cm])js?(x)'], + rules: { + /** + * Allow type inference of return values of exported functions, etc., + * only for JavaScript. By default, it is allowed with a warning. + * + * There are many situations where CommonJS is used outside the scope + * of transpiling, such as in various configuration files, + * where it is challenging to make type definitions mandatory. + */ + '@typescript-eslint/explicit-module-boundary-types': 'off', + }, + }, + { + rules: { + /** + * Forces import without extensions for internal modules only. + * The default is full enforcement. + * + * Because it interferes with imports such as `lodash-es` + * in the ES modules environment. + */ + 'import/extensions': [ + 'error', + 'never', + { js: 'ignorePackages', json: 'ignorePackages' }, + ], + /** + * Prohibit dependencies on `devDependencies`, except for specific + * files. By default, this is a total ban. + * + * There is no need for strict separation of dependent packages since + * they are internally tree shaken by bundlers. Still, some packages + * are separated into `devDependencies` to make it easier to organize. + */ + 'import/no-extraneous-dependencies': [ + 'error', + { + devDependencies: [ + '**/*.config.?([cm])[jt]s?(x)', + '**/*.spec.?([cm])[jt]s?(x)', + '**/*.test.?([cm])[jt]s?(x)', + ], + }, + ], + /** + * Allow with a warning that the arbitrary reordering in the + * import syntax. The default is to allow it unconditionally. + * + * in order to deal with the snowballing problem of the import part. + */ + 'import/order': [ + 'warn', + { + alphabetize: { caseInsensitive: true, order: 'asc' }, + groups: [ + 'builtin', + 'external', + 'internal', + 'parent', + 'sibling', + 'index', + 'object', + ], + 'newlines-between': 'never', + }, + ], + /** + * Allow with a warning that the arbitrary reordering in the + * import syntax. The default is to allow it unconditionally. + * + * To deal with the snowballing problem of the import part. + */ + 'sort-imports': [ + 'warn', + { ignoreCase: true, ignoreDeclarationSort: true }, + ], + }, + }, +]; + +/** The ESLint configuration for the `import` plugin. */ +export const importConfig: readonly Linter.FlatConfig[] = [ + ...compat.extends('plugin:import/recommended'), + ...compat.extends('plugin:import/typescript'), + ...additionalImportConfig, +]; diff --git a/packages/eslint-config-base/src/index.mts b/packages/eslint-config-base/src/index.mts index 5408f03..8ba0d75 100644 --- a/packages/eslint-config-base/src/index.mts +++ b/packages/eslint-config-base/src/index.mts @@ -1,6 +1,31 @@ -import type { Linter } from 'eslint'; +import tsEslint from 'typescript-eslint'; +import { airbnbConfig } from './airbnb.mjs'; +import { dataConfig } from './data.mjs'; +import { ignoreConfig } from './ignore.mjs'; +import { importConfig, additionalImportConfig } from './import.mjs'; +import { jsdocConfig, additionalJsdocConfig } from './jsdoc.mjs'; +import { markdownConfig } from './markdown.mjs'; +import { additionalNodeConfig, nodeConfig } from './node.mjs'; +import { additionalStyleConfig, styleConfig } from './style.mjs'; +import { additionalTsConfig, tsConfig } from './ts.mjs'; +import { compat } from './utils.mjs'; -/** ESLint configuration for generic TypeScript projects. */ -const config: readonly Linter.FlatConfig[] = []; - -export default config; +export default tsEslint.config( + ...([ + ...ignoreConfig, + ...compat.env({ es2024: true, node: true }), + ...markdownConfig, + ...dataConfig, + ...styleConfig, + ...jsdocConfig, + ...importConfig, + ...nodeConfig, + ...tsConfig, + ...airbnbConfig, + ...additionalStyleConfig, + ...additionalJsdocConfig, + ...additionalImportConfig, + ...additionalNodeConfig, + ...additionalTsConfig, + ] as tsEslint.ConfigWithExtends[]), +); diff --git a/packages/eslint-config-base/src/jsdoc.mts b/packages/eslint-config-base/src/jsdoc.mts new file mode 100644 index 0000000..7d0752e --- /dev/null +++ b/packages/eslint-config-base/src/jsdoc.mts @@ -0,0 +1,41 @@ +import type { Linter } from 'eslint'; +import jsdoc from 'eslint-plugin-jsdoc'; + +/** Additional ESLint configurations for JSDoc comments. */ +export const additionalJsdocConfig: readonly Linter.FlatConfig[] = [ + { + rules: { + /** + * Allow unconditional type specification of the arguments in JSDoc. + * The default is a blanket ban. + * + * Because in TypeScript projects, it can be inferred from the type + * definitions in the code. + * + * TODO: + * If there are any inconveniences in document generation, consider + * removing this rule. + */ + 'jsdoc/require-param-type': 'off', + + /** + * Allow unconditional type specification of the return value in JSDoc. + * The default is a blanket ban. + * + * Because in TypeScript projects, it can be inferred from the type + * definitions in the code. + * + * TODO: + * If there are any inconveniences in document generation, consider + * removing this rule. + */ + 'jsdoc/require-returns-type': 'off', + }, + }, +]; + +/** The ESLint configurations for JSDoc comments. */ +export const jsdocConfig: readonly Linter.FlatConfig[] = [ + jsdoc.configs['flat/recommended'], + ...additionalJsdocConfig, +]; diff --git a/packages/eslint-config-base/src/markdown.mts b/packages/eslint-config-base/src/markdown.mts new file mode 100644 index 0000000..24c6d91 --- /dev/null +++ b/packages/eslint-config-base/src/markdown.mts @@ -0,0 +1,17 @@ +import type { Linter } from 'eslint'; +import markdown from 'eslint-plugin-markdown'; +import { compat } from './utils.mjs'; + +/** The ESLint configuration for Markdown files. */ +export const markdownConfig: readonly Linter.FlatConfig[] = [ + ...(markdown.configs.recommended as Linter.FlatConfig[]), + ...compat.config({ + overrides: [ + { + extends: ['plugin:markdownlint/recommended'], + files: ['*.md'], + parser: 'eslint-plugin-markdownlint/parser', + }, + ], + }), +]; diff --git a/packages/eslint-config-base/src/node.mts b/packages/eslint-config-base/src/node.mts new file mode 100644 index 0000000..0b5d155 --- /dev/null +++ b/packages/eslint-config-base/src/node.mts @@ -0,0 +1,41 @@ +import type { Linter } from 'eslint'; +import nodePlugin from 'eslint-plugin-n'; + +/** Additional ESLint configurations for Node.js code. */ +export const additionalNodeConfig: readonly Linter.FlatConfig[] = [ + { + rules: { + /** + * Unconditional permission to import modules that do not exist. + * The default is total prohibition. + * + * A temporary measure to support the ES module resolution in + * TypeScript. + * + * @see {@link https://github.com/mysticatea/eslint-plugin-node/issues/248#issuecomment-1052550467} + */ + 'n/no-missing-import': 'off', + }, + settings: { 'import/resolver': { typescript: { alwaysTryTypes: true } } }, + }, + { + rules: { + /** + * Allows the use of unsupported Node.js notation. + * Unconditional prohibition by default. + * + * All Node.js versions prohibit dynamic imports, and the rule is + * already obsoleted. + * + * TODO: Remove this rule in the future. + */ + 'n/no-unsupported-features/es-syntax': 'off', + }, + }, +]; + +/** The ESLint configuration for Node.js code. */ +export const nodeConfig: readonly Linter.FlatConfig[] = [ + nodePlugin.configs['flat/recommended-script'], + ...additionalNodeConfig, +]; diff --git a/packages/eslint-config-base/src/style.mts b/packages/eslint-config-base/src/style.mts new file mode 100644 index 0000000..e750b20 --- /dev/null +++ b/packages/eslint-config-base/src/style.mts @@ -0,0 +1,28 @@ +import cspell from '@cspell/eslint-plugin/recommended'; +import type { Linter } from 'eslint'; +import prettier from 'eslint-config-prettier'; +import { compat } from './utils.mjs'; + +/** Additional configuration for the style language files. */ +export const additionalStyleConfig: readonly Linter.FlatConfig[] = [ + ...compat.extends('plugin:editorconfig/noconflict'), + prettier, + { + rules: { + /** + * Permit explicit statements in Arrow functions, even when the block + * is optional, with a warning. The default is unconditional allow. + * + * The intent is to reduce the amount of code and keep it simple, + * thereby improving readability. + */ + 'arrow-body-style': 'warn', + }, + }, +]; + +/** The ESLint configuration for style language files. */ +export const styleConfig: readonly Linter.FlatConfig[] = [ + { plugins: cspell.plugins ?? {}, rules: cspell.rules ?? {} }, + ...additionalStyleConfig, +]; diff --git a/packages/eslint-config-base/src/ts.mts b/packages/eslint-config-base/src/ts.mts new file mode 100644 index 0000000..86797b6 --- /dev/null +++ b/packages/eslint-config-base/src/ts.mts @@ -0,0 +1,41 @@ +import eslint from '@eslint/js'; +import type { Linter } from 'eslint'; +import oxlint from 'eslint-plugin-oxlint'; +import type { ConfigWithExtends } from 'typescript-eslint'; +import tsesLint from 'typescript-eslint'; + +/** Additional ESLint configurations for TypeScript. */ +export const additionalTsConfig: readonly Linter.FlatConfig[] = [ + { + rules: { + /** + * With a warning, allow use standard import syntax to import for + * type-only. The default is to enable it unconditionally. + * + * Tree shaking at build time needs to work correctly to reduce + * bundle size, and active use of the type import syntax can + * contribute significantly to this. + */ + '@typescript-eslint/consistent-type-imports': 'warn', + /** + * With a warning, allow type inference for return values of functions + * and methods referenced from other files, including public methods + * in exported functions and classes. Default is unconditional allow. + * + * Allowing this may cause TypeScript to chain type inference from the + * wrong type if it does not read the type definition correctly, + * resulting in type errors in the wrong places. + */ + '@typescript-eslint/explicit-module-boundary-types': 'warn', + }, + }, +]; + +/** The ESLint configurations for TypeScript. */ +export const tsConfig: readonly ConfigWithExtends[] = [ + eslint.configs.recommended, + ...tsesLint.configs.recommended, + ...tsesLint.configs.stylistic, + oxlint.configs['flat/recommended'] as Pick, + ...additionalTsConfig, +]; diff --git a/packages/eslint-config-base/src/utils.mts b/packages/eslint-config-base/src/utils.mts new file mode 100644 index 0000000..5b4d1cb --- /dev/null +++ b/packages/eslint-config-base/src/utils.mts @@ -0,0 +1,13 @@ +import { dirname } from 'node:path'; +import { fileURLToPath } from 'node:url'; +import { FlatCompat } from '@eslint/eslintrc'; +import eslint from '@eslint/js'; + +/** The directory of the current file. */ +export const __dirname = dirname(fileURLToPath(import.meta.url)); + +/** The compatibility layer for ESLint configuration. */ +export const compat = new FlatCompat({ + baseDirectory: __dirname, + recommendedConfig: eslint.configs.recommended, +}); diff --git a/packages/eslint-config-base/tsconfig.json b/packages/eslint-config-base/tsconfig.json index e74e45b..5b22c98 100644 --- a/packages/eslint-config-base/tsconfig.json +++ b/packages/eslint-config-base/tsconfig.json @@ -2,7 +2,9 @@ "compilerOptions": { "lib": ["ESNext"], "outDir": "dist", - "rootDir": "src" + "rootDir": "src", + "skipLibCheck": true, + "types": ["node"] }, "extends": "@kurone-kito/typescript-config/tsconfig.json" } diff --git a/packages/eslint-config-react/README.md b/packages/eslint-config-react/README.md index 59efbc5..aed7499 100644 --- a/packages/eslint-config-react/README.md +++ b/packages/eslint-config-react/README.md @@ -4,6 +4,25 @@ My ESLint configuration for React projects. ## Usage +### Use the flat config (recommended) + +First, install this package and its peer dependencies: + +```sh +npm install --save-dev @kurone-kito/eslint-config-react eslint +``` + +Then, create a `eslint.config.mjs` file. +If exists, merge the following configuration into it: + +```js +export { default } from '@kurone-kito/eslint-config-react'; +``` + +### for legacy configuration (deprecated) + +⚠️ **DEPRECATED**: The legacy configuration is no longer maintained. + First, install this package and its peer dependencies: ```sh @@ -14,23 +33,17 @@ npm install --save-dev \ @typescript-eslint/parser \ eslint \ eslint-config-airbnb-typescript \ - eslint-config-prettier \ eslint-formatter-codeframe \ eslint-import-resolver-node \ eslint-import-resolver-typescript \ eslint-plugin-editorconfig \ eslint-plugin-import \ - eslint-plugin-jsdoc \ - eslint-plugin-json \ eslint-plugin-jsx-a11y \ - eslint-plugin-markdown \ eslint-plugin-markdownlint \ eslint-plugin-n \ - eslint-plugin-oxlint \ eslint-plugin-react \ eslint-plugin-react-hooks \ - eslint-plugin-storybook \ - eslint-plugin-yaml + eslint-plugin-storybook ``` Then, create a `.eslintrc.yml` file. diff --git a/packages/eslint-config-react/package.json b/packages/eslint-config-react/package.json index 7cc11af..b34e0cd 100644 --- a/packages/eslint-config-react/package.json +++ b/packages/eslint-config-react/package.json @@ -40,130 +40,41 @@ "start": "tsc --watch" }, "dependencies": { - "@kurone-kito/eslint-config-base": "workspace:^" - }, - "devDependencies": { - "@cspell/eslint-plugin": "^8.12.1", - "@kurone-kito/typescript-config": "workspace:^", - "@types/eslint": "^8.56.11", + "@eslint/eslintrc": "^3.1.0", + "@eslint/js": "^9.7.0", + "@kurone-kito/eslint-config-base": "workspace:^", "@typescript-eslint/eslint-plugin": "^7.17.0", "@typescript-eslint/parser": "^7.17.0", - "concurrently": "^8.2.2", - "cpy-cli": "^5.0.0", - "eslint": "^8.57.0", + "eslint-config-airbnb": "^19.0.4", "eslint-config-airbnb-typescript": "^18.0.0", - "eslint-config-prettier": "^9.1.0", - "eslint-formatter-codeframe": "^7.32.1", - "eslint-import-resolver-node": "^0.3.9", - "eslint-import-resolver-typescript": "^3.6.1", - "eslint-plugin-editorconfig": "^4.0.3", "eslint-plugin-import": "^2.29.1", - "eslint-plugin-jsdoc": "^48.8.3", - "eslint-plugin-json": "^4.0.0", "eslint-plugin-jsx-a11y": "^6.9.0", - "eslint-plugin-markdown": "^5.1.0", - "eslint-plugin-markdownlint": "^0.6.0", - "eslint-plugin-n": "^17.9.0", - "eslint-plugin-oxlint": "^0.5.0", "eslint-plugin-react": "^7.35.0", "eslint-plugin-react-hooks": "^4.6.2", "eslint-plugin-storybook": "^0.8.0", - "eslint-plugin-yaml": "^1.0.3", + "typescript-eslint": "^7.17.0" + }, + "devDependencies": { + "@kurone-kito/typescript-config": "workspace:^", + "@types/eslint": "^9.6.0", + "@types/eslint__eslintrc": "^2.1.2", + "@types/eslint__js": "^8.42.3", + "@types/node": "^20.14.12", + "@typescript-eslint/utils": "^7.17.0", + "concurrently": "^8.2.2", + "cpy-cli": "^5.0.0", + "eslint": "^9.7.0", + "eslint-formatter-codeframe": "^7.32.1", "js-yaml": "^4.1.0", - "prettier": "^3.3.3", "rimraf": "^5.0.9", "typescript": "~5.5.4" }, "peerDependencies": { - "@cspell/eslint-plugin": ">=6.x.x", - "@typescript-eslint/eslint-plugin": ">=6.0.x", - "@typescript-eslint/parser": ">=6.0.x", - "eslint": ">=8.2.x", - "eslint-config-airbnb-typescript": ">=17.x.x", - "eslint-config-prettier": ">=8.x.x", - "eslint-formatter-codeframe": ">=7.x.x", - "eslint-import-resolver-node": ">=0.3.x", - "eslint-import-resolver-typescript": ">=3.x.x", - "eslint-plugin-editorconfig": ">=4.x.x", - "eslint-plugin-import": ">=2.27.x", - "eslint-plugin-jsdoc": ">=46.x.x", - "eslint-plugin-json": ">=4.x.x", - "eslint-plugin-jsx-a11y": ">=6.x.x", - "eslint-plugin-markdown": ">=3.x.x", - "eslint-plugin-markdownlint": ">=0.5.x", - "eslint-plugin-n": ">=17.x.x", - "eslint-plugin-oxlint": ">=0.2.x", - "eslint-plugin-react": ">=7.2.x", - "eslint-plugin-react-hooks": ">=4.3.x", - "eslint-plugin-storybook": ">=0.6.x", - "eslint-plugin-yaml": ">=0.5.x" + "eslint": ">=9.x.x" }, "peerDependenciesMeta": { - "@cspell/eslint-plugin": { - "optional": true - }, - "@typescript-eslint/eslint-plugin": { - "optional": true - }, - "@typescript-eslint/parser": { - "optional": true - }, "eslint": { "optional": true - }, - "eslint-config-airbnb-typescript": { - "optional": true - }, - "eslint-config-prettier": { - "optional": true - }, - "eslint-formatter-codeframe": { - "optional": true - }, - "eslint-import-resolver-node": { - "optional": true - }, - "eslint-import-resolver-typescript": { - "optional": true - }, - "eslint-plugin-editorconfig": { - "optional": true - }, - "eslint-plugin-import": { - "optional": true - }, - "eslint-plugin-jsdoc": { - "optional": true - }, - "eslint-plugin-json": { - "optional": true - }, - "eslint-plugin-jsx-a11y": { - "optional": true - }, - "eslint-plugin-markdown": { - "optional": true - }, - "eslint-plugin-markdownlint": { - "optional": true - }, - "eslint-plugin-n": { - "optional": true - }, - "eslint-plugin-oxlint": { - "optional": true - }, - "eslint-plugin-react": { - "optional": true - }, - "eslint-plugin-react-hooks": { - "optional": true - }, - "eslint-plugin-storybook": { - "optional": true - }, - "eslint-plugin-yaml": { - "optional": true } }, "engines": { diff --git a/packages/eslint-config-react/src/index.mts b/packages/eslint-config-react/src/index.mts index 6bbf017..8bc7c75 100644 --- a/packages/eslint-config-react/src/index.mts +++ b/packages/eslint-config-react/src/index.mts @@ -1,7 +1,17 @@ import baseConfig from '@kurone-kito/eslint-config-base'; -import type { Linter } from 'eslint'; +import tsEslint from 'typescript-eslint'; +import { additionalReactConfig, reactConfig } from './react.mjs'; +import { storybookConfig } from './storybook.mjs'; +import { compat } from './utils.mjs'; -/** ESLint configuration for generic React projects. */ -const config: readonly Linter.FlatConfig[] = [...baseConfig]; - -export default config; +export default tsEslint.config( + ...([ + ...reactConfig, + ...compat.extends('airbnb'), + ...compat.extends('airbnb-typescript'), + ...baseConfig, + ...additionalReactConfig, + ...storybookConfig, + { languageOptions: { parserOptions: { ecmaFeatures: { jsx: true } } } }, + ] as tsEslint.ConfigWithExtends[]), +); diff --git a/packages/eslint-config-react/src/react.mts b/packages/eslint-config-react/src/react.mts new file mode 100644 index 0000000..7647658 --- /dev/null +++ b/packages/eslint-config-react/src/react.mts @@ -0,0 +1,48 @@ +import type { Linter } from 'eslint'; +import { compat } from './utils.mjs'; + +/** Additional configuration for ESLint to React */ +export const additionalReactConfig: readonly Linter.FlatConfig[] = [ + { + rules: { + /** + * Allows explicit notation of `true` in JSX notation with a warning. + * It's unconditionally permitted by default. + * + * Because `true` is optional, the intent is to improve readability + * by reducing the amount of code and keeping it simple. + */ + 'react/jsx-boolean-value': 'warn', + /** + * Allows explicit string value notation in JSX notation with a + * warning. The default is unconditional permission. + * + * String values can be described simply as constant attributes + * intended to reduce code and improve readability. + */ + 'react/jsx-curly-brace-presence': 'warn', + /** + * Starting with React 17, the `React` import in JSX/TSX is no longer + * required, and this rule is no longer necessary. + * + * The default is to force it in JSX/TSX. + * @see {@link https://reactjs.org/blog/2020/09/22/introducing-the-new-jsx-transform.html} + */ + 'react/react-in-jsx-scope': 'off', + /** + * Allows explicit notation of the absence of child elements in JSX + * notation with a warning. The default is unconditional permission. + * + * Self-contained tags are intended to reduce the amount of code, + * keep things more straightforward, and improve readability. + */ + 'react/self-closing-comp': 'warn', + }, + }, +]; + +/** Configuration for ESLint to React */ +export const reactConfig: readonly Linter.FlatConfig[] = [ + ...compat.extends('plugin:react-hooks/recommended'), + ...additionalReactConfig, +]; diff --git a/packages/eslint-config-react/src/storybook.mts b/packages/eslint-config-react/src/storybook.mts new file mode 100644 index 0000000..1dc06dc --- /dev/null +++ b/packages/eslint-config-react/src/storybook.mts @@ -0,0 +1,33 @@ +import type { Linter } from 'eslint'; + +/** The configuration for ESLint to Storybook */ +export const storybookConfig: readonly Linter.FlatConfig[] = [ + { + files: ['**/*.stories.?([cm])[jt]s?(x)'], + rules: { + /** + * Unconditionally allow export to `default`. + * + * The default is unknown, but since Storybook component definitions + * are structurally dependent on export to `default`, this permission + * is explicitly stated to prevent influence by later configuration + * updates. + */ + 'import/no-anonymous-default-export': 'off', + /** + * Exporting code that depends `on devDependencies is` allowed only + * for specific packages on an exception basis, and it is prohibited + * by default. + * + * To organize dependencies, only packages that directly depend on + * the product code should be listed in the dependencies list, so + * Storybook component definitions not included in the product code + * are exceptionally allowed to rely on `devDependencies`. + */ + 'n/no-unpublished-import': [ + 'error', + { allow: ['@storybook/react', '@storybook/testing-library'] }, + ], + }, + }, +]; diff --git a/packages/eslint-config-react/src/utils.mts b/packages/eslint-config-react/src/utils.mts new file mode 100644 index 0000000..5b4d1cb --- /dev/null +++ b/packages/eslint-config-react/src/utils.mts @@ -0,0 +1,13 @@ +import { dirname } from 'node:path'; +import { fileURLToPath } from 'node:url'; +import { FlatCompat } from '@eslint/eslintrc'; +import eslint from '@eslint/js'; + +/** The directory of the current file. */ +export const __dirname = dirname(fileURLToPath(import.meta.url)); + +/** The compatibility layer for ESLint configuration. */ +export const compat = new FlatCompat({ + baseDirectory: __dirname, + recommendedConfig: eslint.configs.recommended, +}); diff --git a/packages/eslint-config-react/tsconfig.json b/packages/eslint-config-react/tsconfig.json index e74e45b..5b22c98 100644 --- a/packages/eslint-config-react/tsconfig.json +++ b/packages/eslint-config-react/tsconfig.json @@ -2,7 +2,9 @@ "compilerOptions": { "lib": ["ESNext"], "outDir": "dist", - "rootDir": "src" + "rootDir": "src", + "skipLibCheck": true, + "types": ["node"] }, "extends": "@kurone-kito/typescript-config/tsconfig.json" } diff --git a/packages/typescript-config/package.json b/packages/typescript-config/package.json index ee09fb3..da0af7e 100644 --- a/packages/typescript-config/package.json +++ b/packages/typescript-config/package.json @@ -35,7 +35,7 @@ "@typescript-eslint/parser": "^7.17.0", "concurrently": "^8.2.2", "cpy-cli": "^5.0.0", - "eslint": "^8.57.0", + "eslint": "^9.7.0", "typescript": "~5.5.4", "typescript-eslint-language-service": "^5.0.5" }, diff --git a/yarn.lock b/yarn.lock index 34fa695..0e434c3 100644 --- a/yarn.lock +++ b/yarn.lock @@ -791,6 +791,24 @@ __metadata: languageName: node linkType: hard +"@eslint/compat@npm:^1.1.1": + version: 1.1.1 + resolution: "@eslint/compat@npm:1.1.1" + checksum: 10/9004697701e9e9a7749d9e37452ee965af3620af46796ac0ee196478bbda490c780d17686c2888353c2a12d764837fa71c027c3ca18b1c3af6136105caa93642 + languageName: node + linkType: hard + +"@eslint/config-array@npm:^0.17.0": + version: 0.17.1 + resolution: "@eslint/config-array@npm:0.17.1" + dependencies: + "@eslint/object-schema": "npm:^2.1.4" + debug: "npm:^4.3.1" + minimatch: "npm:^3.1.2" + checksum: 10/d837852445d3cfc62da5e0d94ab036aa4393751cf2ee71676df61ec77bffabaa73f87207bfa200b8d0e7e95b556704f29f35f2f22d63d1ce2e285db4a325a2df + languageName: node + linkType: hard + "@eslint/eslintrc@npm:^2.1.4": version: 2.1.4 resolution: "@eslint/eslintrc@npm:2.1.4" @@ -808,6 +826,23 @@ __metadata: languageName: node linkType: hard +"@eslint/eslintrc@npm:^3.1.0": + version: 3.1.0 + resolution: "@eslint/eslintrc@npm:3.1.0" + dependencies: + ajv: "npm:^6.12.4" + debug: "npm:^4.3.2" + espree: "npm:^10.0.1" + globals: "npm:^14.0.0" + ignore: "npm:^5.2.0" + import-fresh: "npm:^3.2.1" + js-yaml: "npm:^4.1.0" + minimatch: "npm:^3.1.2" + strip-json-comments: "npm:^3.1.1" + checksum: 10/02bf892d1397e1029209dea685e9f4f87baf643315df2a632b5f121ec7e8548a3b34f428a007234fa82772218fa8a3ac2d10328637b9ce63b7f8344035b74db3 + languageName: node + linkType: hard + "@eslint/js@npm:8.57.0": version: 8.57.0 resolution: "@eslint/js@npm:8.57.0" @@ -815,6 +850,20 @@ __metadata: languageName: node linkType: hard +"@eslint/js@npm:9.7.0, @eslint/js@npm:^9.7.0": + version: 9.7.0 + resolution: "@eslint/js@npm:9.7.0" + checksum: 10/b56b9fdec705f2cefae3a6d9d4227c4c28c5cbdbd8849c7997c357cabd4a729cee4445ddb43bb1423fbeb2280a119ced4d0819be8749d107c511e9d81dfe863a + languageName: node + linkType: hard + +"@eslint/object-schema@npm:^2.1.4": + version: 2.1.4 + resolution: "@eslint/object-schema@npm:2.1.4" + checksum: 10/221e8d9f281c605948cd6e030874aacce83fe097f8f9c1964787037bccf08e82b7aa9eff1850a30fffac43f1d76555727ec22a2af479d91e268e89d1e035131e + languageName: node + linkType: hard + "@humanwhocodes/config-array@npm:^0.11.14": version: 0.11.14 resolution: "@humanwhocodes/config-array@npm:0.11.14" @@ -840,6 +889,13 @@ __metadata: languageName: node linkType: hard +"@humanwhocodes/retry@npm:^0.3.0": + version: 0.3.0 + resolution: "@humanwhocodes/retry@npm:0.3.0" + checksum: 10/e574bab58680867414e225c9002e9a97eb396f85871c180fbb1a9bcdf9ded4b4de0b327f7d0c43b775873362b7c92956d4b322e8bc4b90be56077524341f04b2 + languageName: node + linkType: hard + "@isaacs/cliui@npm:^8.0.2": version: 8.0.2 resolution: "@isaacs/cliui@npm:8.0.2" @@ -886,13 +942,23 @@ __metadata: resolution: "@kurone-kito/eslint-config-base@workspace:packages/eslint-config-base" dependencies: "@cspell/eslint-plugin": "npm:^8.12.1" + "@eslint/compat": "npm:^1.1.1" + "@eslint/eslintrc": "npm:^3.1.0" + "@eslint/js": "npm:^9.7.0" "@kurone-kito/typescript-config": "workspace:^" - "@types/eslint": "npm:^8.56.11" + "@types/eslint": "npm:^9.6.0" + "@types/eslint-config-prettier": "npm:^6.11.3" + "@types/eslint-plugin-markdown": "npm:^2.0.2" + "@types/eslint__eslintrc": "npm:^2.1.2" + "@types/eslint__js": "npm:^8.42.3" + "@types/node": "npm:^20.14.12" "@typescript-eslint/eslint-plugin": "npm:^7.17.0" "@typescript-eslint/parser": "npm:^7.17.0" + "@typescript-eslint/utils": "npm:^7.17.0" concurrently: "npm:^8.2.2" cpy-cli: "npm:^5.0.0" - eslint: "npm:^8.57.0" + eslint: "npm:^9.7.0" + eslint-config-airbnb-base: "npm:^15.0.0" eslint-config-airbnb-typescript: "npm:^18.0.0" eslint-config-prettier: "npm:^9.1.0" eslint-formatter-codeframe: "npm:^7.32.1" @@ -908,65 +974,14 @@ __metadata: eslint-plugin-oxlint: "npm:^0.5.0" eslint-plugin-yaml: "npm:^1.0.3" js-yaml: "npm:^4.1.0" - prettier: "npm:^3.3.3" rimraf: "npm:^5.0.9" typescript: "npm:~5.5.4" + typescript-eslint: "npm:^7.17.0" peerDependencies: - "@cspell/eslint-plugin": ">=6.x.x" - "@typescript-eslint/eslint-plugin": ">=6.0.x" - "@typescript-eslint/parser": ">=6.0.x" - eslint: ">=8.2.x" - eslint-config-airbnb-typescript: ">=17.x.x" - eslint-config-prettier: ">=8.x.x" - eslint-formatter-codeframe: ">=7.x.x" - eslint-import-resolver-node: ">=0.3.x" - eslint-import-resolver-typescript: ">=3.x.x" - eslint-plugin-editorconfig: ">=4.x.x" - eslint-plugin-import: ">=2.27.x" - eslint-plugin-jsdoc: ">=46.x.x" - eslint-plugin-json: ">=4.x.x" - eslint-plugin-markdown: ">=3.x.x" - eslint-plugin-markdownlint: ">=0.5.x" - eslint-plugin-n: ">=17.x.x" - eslint-plugin-oxlint: ">=0.2.x" - eslint-plugin-yaml: ">=0.5.x" + eslint: ">=9.x.x" peerDependenciesMeta: - "@cspell/eslint-plugin": - optional: true - "@typescript-eslint/eslint-plugin": - optional: true - "@typescript-eslint/parser": - optional: true eslint: optional: true - eslint-config-airbnb-typescript: - optional: true - eslint-config-prettier: - optional: true - eslint-formatter-codeframe: - optional: true - eslint-import-resolver-node: - optional: true - eslint-import-resolver-typescript: - optional: true - eslint-plugin-editorconfig: - optional: true - eslint-plugin-import: - optional: true - eslint-plugin-jsdoc: - optional: true - eslint-plugin-json: - optional: true - eslint-plugin-markdown: - optional: true - eslint-plugin-markdownlint: - optional: true - eslint-plugin-n: - optional: true - eslint-plugin-oxlint: - optional: true - eslint-plugin-yaml: - optional: true languageName: unknown linkType: soft @@ -974,105 +989,37 @@ __metadata: version: 0.0.0-use.local resolution: "@kurone-kito/eslint-config-react@workspace:packages/eslint-config-react" dependencies: - "@cspell/eslint-plugin": "npm:^8.12.1" + "@eslint/eslintrc": "npm:^3.1.0" + "@eslint/js": "npm:^9.7.0" "@kurone-kito/eslint-config-base": "workspace:^" "@kurone-kito/typescript-config": "workspace:^" - "@types/eslint": "npm:^8.56.11" + "@types/eslint": "npm:^9.6.0" + "@types/eslint__eslintrc": "npm:^2.1.2" + "@types/eslint__js": "npm:^8.42.3" + "@types/node": "npm:^20.14.12" "@typescript-eslint/eslint-plugin": "npm:^7.17.0" "@typescript-eslint/parser": "npm:^7.17.0" + "@typescript-eslint/utils": "npm:^7.17.0" concurrently: "npm:^8.2.2" cpy-cli: "npm:^5.0.0" - eslint: "npm:^8.57.0" + eslint: "npm:^9.7.0" + eslint-config-airbnb: "npm:^19.0.4" eslint-config-airbnb-typescript: "npm:^18.0.0" - eslint-config-prettier: "npm:^9.1.0" eslint-formatter-codeframe: "npm:^7.32.1" - eslint-import-resolver-node: "npm:^0.3.9" - eslint-import-resolver-typescript: "npm:^3.6.1" - eslint-plugin-editorconfig: "npm:^4.0.3" eslint-plugin-import: "npm:^2.29.1" - eslint-plugin-jsdoc: "npm:^48.8.3" - eslint-plugin-json: "npm:^4.0.0" eslint-plugin-jsx-a11y: "npm:^6.9.0" - eslint-plugin-markdown: "npm:^5.1.0" - eslint-plugin-markdownlint: "npm:^0.6.0" - eslint-plugin-n: "npm:^17.9.0" - eslint-plugin-oxlint: "npm:^0.5.0" eslint-plugin-react: "npm:^7.35.0" eslint-plugin-react-hooks: "npm:^4.6.2" eslint-plugin-storybook: "npm:^0.8.0" - eslint-plugin-yaml: "npm:^1.0.3" js-yaml: "npm:^4.1.0" - prettier: "npm:^3.3.3" rimraf: "npm:^5.0.9" typescript: "npm:~5.5.4" + typescript-eslint: "npm:^7.17.0" peerDependencies: - "@cspell/eslint-plugin": ">=6.x.x" - "@typescript-eslint/eslint-plugin": ">=6.0.x" - "@typescript-eslint/parser": ">=6.0.x" - eslint: ">=8.2.x" - eslint-config-airbnb-typescript: ">=17.x.x" - eslint-config-prettier: ">=8.x.x" - eslint-formatter-codeframe: ">=7.x.x" - eslint-import-resolver-node: ">=0.3.x" - eslint-import-resolver-typescript: ">=3.x.x" - eslint-plugin-editorconfig: ">=4.x.x" - eslint-plugin-import: ">=2.27.x" - eslint-plugin-jsdoc: ">=46.x.x" - eslint-plugin-json: ">=4.x.x" - eslint-plugin-jsx-a11y: ">=6.x.x" - eslint-plugin-markdown: ">=3.x.x" - eslint-plugin-markdownlint: ">=0.5.x" - eslint-plugin-n: ">=17.x.x" - eslint-plugin-oxlint: ">=0.2.x" - eslint-plugin-react: ">=7.2.x" - eslint-plugin-react-hooks: ">=4.3.x" - eslint-plugin-storybook: ">=0.6.x" - eslint-plugin-yaml: ">=0.5.x" + eslint: ">=9.x.x" peerDependenciesMeta: - "@cspell/eslint-plugin": - optional: true - "@typescript-eslint/eslint-plugin": - optional: true - "@typescript-eslint/parser": - optional: true eslint: optional: true - eslint-config-airbnb-typescript: - optional: true - eslint-config-prettier: - optional: true - eslint-formatter-codeframe: - optional: true - eslint-import-resolver-node: - optional: true - eslint-import-resolver-typescript: - optional: true - eslint-plugin-editorconfig: - optional: true - eslint-plugin-import: - optional: true - eslint-plugin-jsdoc: - optional: true - eslint-plugin-json: - optional: true - eslint-plugin-jsx-a11y: - optional: true - eslint-plugin-markdown: - optional: true - eslint-plugin-markdownlint: - optional: true - eslint-plugin-n: - optional: true - eslint-plugin-oxlint: - optional: true - eslint-plugin-react: - optional: true - eslint-plugin-react-hooks: - optional: true - eslint-plugin-storybook: - optional: true - eslint-plugin-yaml: - optional: true languageName: unknown linkType: soft @@ -1100,7 +1047,6 @@ __metadata: "@commitlint/cli": "npm:^19.3.0" "@commitlint/config-conventional": "npm:^19.2.2" "@cspell/cspell-types": "npm:^8.12.1" - "@cspell/eslint-plugin": "npm:^8.12.1" "@kurone-kito/commitlint-config": "workspace:^" "@kurone-kito/cspell-config": "workspace:^" "@kurone-kito/eslint-config-base": "workspace:^" @@ -1109,27 +1055,13 @@ __metadata: "@kurone-kito/markdownlint-config": "workspace:^" "@kurone-kito/prettier-config": "workspace:^" "@kurone-kito/typescript-config": "workspace:^" - "@typescript-eslint/eslint-plugin": "npm:^7.17.0" + "@types/eslint": "npm:^9.6.0" "@typescript-eslint/parser": "npm:^7.17.0" "@yarnpkg/sdks": "npm:^3.1.3" concurrently: "npm:^8.2.2" cspell: "npm:^8.12.1" - eslint: "npm:^8.57.0" - eslint-config-airbnb-typescript: "npm:^18.0.0" - eslint-config-prettier: "npm:^9.1.0" + eslint: "npm:^9.7.0" eslint-formatter-codeframe: "npm:^7.32.1" - eslint-import-resolver-node: "npm:^0.3.9" - eslint-import-resolver-typescript: "npm:^3.6.1" - eslint-plugin-editorconfig: "npm:^4.0.3" - eslint-plugin-import: "npm:^2.29.1" - eslint-plugin-jsdoc: "npm:^48.8.3" - eslint-plugin-json: "npm:^4.0.0" - eslint-plugin-markdown: "npm:^5.1.0" - eslint-plugin-markdownlint: "npm:^0.6.0" - eslint-plugin-n: "npm:^17.9.0" - eslint-plugin-oxlint: "npm:^0.5.0" - eslint-plugin-react: "npm:^7.35.0" - eslint-plugin-yaml: "npm:^1.0.3" husky: "npm:^9.1.1" lint-staged: "npm:^15.2.7" markdownlint-cli2: "npm:^0.13.0" @@ -1170,7 +1102,7 @@ __metadata: "@typescript-eslint/parser": "npm:^7.17.0" concurrently: "npm:^8.2.2" cpy-cli: "npm:^5.0.0" - eslint: "npm:^8.57.0" + eslint: "npm:^9.7.0" typescript: "npm:~5.5.4" typescript-eslint-language-service: "npm:^5.0.5" peerDependencies: @@ -1351,13 +1283,48 @@ __metadata: languageName: node linkType: hard -"@types/eslint@npm:^8.56.11": - version: 8.56.11 - resolution: "@types/eslint@npm:8.56.11" +"@types/eslint-config-prettier@npm:^6.11.3": + version: 6.11.3 + resolution: "@types/eslint-config-prettier@npm:6.11.3" + checksum: 10/b69ad5d7452f614450fcaf78b4055cfb11afb632f1ef292a3229cb5ac9a7041106a85cf634c570fbd3bb9db59c8fee7ca0e32a059e6fcad2477e22d81d5c3ef3 + languageName: node + linkType: hard + +"@types/eslint-plugin-markdown@npm:^2.0.2": + version: 2.0.2 + resolution: "@types/eslint-plugin-markdown@npm:2.0.2" + dependencies: + "@types/eslint": "npm:*" + "@types/unist": "npm:*" + checksum: 10/7711de5489e9fc859552a11e2afdf680a4585c6e4cacb497f7c51e51dc5331daf3e8e3c967d483d23897fd4825e71a27e53e892e086d94e4e643825ff9f9170f + languageName: node + linkType: hard + +"@types/eslint@npm:*, @types/eslint@npm:^9.6.0": + version: 9.6.0 + resolution: "@types/eslint@npm:9.6.0" dependencies: "@types/estree": "npm:*" "@types/json-schema": "npm:*" - checksum: 10/cfc4409973ed8d3ed183bc477bcfed39ea3fd264dc1da4a11b9c002d1e5fb96de8abed67f60a0e32a668cc2817b2b1c27a1885ec5de5fdc5471bcc99d5d1f75b + checksum: 10/39fc797c671ec9c9184802b4974748cf45ee1b11d7aaaaede44426abcafd07ec7c18eb090e8f5b3387b51637ce3fdf54499472d8dd58a928f0d005cbacb573b4 + languageName: node + linkType: hard + +"@types/eslint__eslintrc@npm:^2.1.2": + version: 2.1.2 + resolution: "@types/eslint__eslintrc@npm:2.1.2" + dependencies: + "@types/eslint": "npm:*" + checksum: 10/3aa91058e0a37306a98ad28681e6662e66d93462b668a06a0e53ea8cd60d93bd5341e3cb8f57be70fafa747418cb7d4741d0c49d6996914ffe452e6c22097ee9 + languageName: node + linkType: hard + +"@types/eslint__js@npm:^8.42.3": + version: 8.42.3 + resolution: "@types/eslint__js@npm:8.42.3" + dependencies: + "@types/eslint": "npm:*" + checksum: 10/e31f19de642d35a664695d0cab873ce6de19b8a3506755835b91f8a49a8c41099dcace449df49f1a486de6fa6565d21ceb1fa33be6004fc7adef9226e5d256a1 languageName: node linkType: hard @@ -1407,7 +1374,7 @@ __metadata: languageName: node linkType: hard -"@types/node@npm:*": +"@types/node@npm:*, @types/node@npm:^20.14.12": version: 20.14.12 resolution: "@types/node@npm:20.14.12" dependencies: @@ -1439,6 +1406,13 @@ __metadata: languageName: node linkType: hard +"@types/unist@npm:*": + version: 3.0.2 + resolution: "@types/unist@npm:3.0.2" + checksum: 10/3d04d0be69316e5f14599a0d993a208606c12818cf631fd399243d1dc7a9bd8a3917d6066baa6abc290814afbd744621484756803c80cba892c39cd4b4a85616 + languageName: node + linkType: hard + "@types/unist@npm:^2, @types/unist@npm:^2.0.2": version: 2.0.10 resolution: "@types/unist@npm:2.0.10" @@ -1446,7 +1420,7 @@ __metadata: languageName: node linkType: hard -"@typescript-eslint/eslint-plugin@npm:^7.17.0": +"@typescript-eslint/eslint-plugin@npm:7.17.0, @typescript-eslint/eslint-plugin@npm:^7.17.0": version: 7.17.0 resolution: "@typescript-eslint/eslint-plugin@npm:7.17.0" dependencies: @@ -1469,7 +1443,7 @@ __metadata: languageName: node linkType: hard -"@typescript-eslint/parser@npm:^7.17.0": +"@typescript-eslint/parser@npm:7.17.0, @typescript-eslint/parser@npm:^7.17.0": version: 7.17.0 resolution: "@typescript-eslint/parser@npm:7.17.0" dependencies: @@ -1575,7 +1549,7 @@ __metadata: languageName: node linkType: hard -"@typescript-eslint/utils@npm:7.17.0": +"@typescript-eslint/utils@npm:7.17.0, @typescript-eslint/utils@npm:^7.17.0": version: 7.17.0 resolution: "@typescript-eslint/utils@npm:7.17.0" dependencies: @@ -1757,7 +1731,7 @@ __metadata: languageName: node linkType: hard -"acorn@npm:^8.9.0": +"acorn@npm:^8.12.0, acorn@npm:^8.9.0": version: 8.12.1 resolution: "acorn@npm:8.12.1" bin: @@ -3262,6 +3236,23 @@ __metadata: languageName: node linkType: hard +"eslint-config-airbnb@npm:^19.0.4": + version: 19.0.4 + resolution: "eslint-config-airbnb@npm:19.0.4" + dependencies: + eslint-config-airbnb-base: "npm:^15.0.0" + object.assign: "npm:^4.1.2" + object.entries: "npm:^1.1.5" + peerDependencies: + eslint: ^7.32.0 || ^8.2.0 + eslint-plugin-import: ^2.25.3 + eslint-plugin-jsx-a11y: ^6.5.1 + eslint-plugin-react: ^7.28.0 + eslint-plugin-react-hooks: ^4.3.0 + checksum: 10/f2086523cfd20c42fd620c757281bd028aa8ce9dadc7293c5c23ea60947a2d3ca04404ede77b40f5a65250fe3c04502acafc4f2f6946819fe6c257d76d9644e5 + languageName: node + linkType: hard + "eslint-config-prettier@npm:^9.1.0": version: 9.1.0 resolution: "eslint-config-prettier@npm:9.1.0" @@ -3561,6 +3552,16 @@ __metadata: languageName: node linkType: hard +"eslint-scope@npm:^8.0.2": + version: 8.0.2 + resolution: "eslint-scope@npm:8.0.2" + dependencies: + esrecurse: "npm:^4.3.0" + estraverse: "npm:^5.2.0" + checksum: 10/d17c2e1ff4d3a98911414a954531078db912e2747d6da8ea4cafd16d0526e32086c676ce9aeaffb3ca0ff695fc951ac3169d7f08a0b42962db683dff126cc95b + languageName: node + linkType: hard + "eslint-visitor-keys@npm:^3.3.0, eslint-visitor-keys@npm:^3.4.1, eslint-visitor-keys@npm:^3.4.3": version: 3.4.3 resolution: "eslint-visitor-keys@npm:3.4.3" @@ -3568,7 +3569,14 @@ __metadata: languageName: node linkType: hard -"eslint@npm:^8.40.0, eslint@npm:^8.57.0": +"eslint-visitor-keys@npm:^4.0.0": + version: 4.0.0 + resolution: "eslint-visitor-keys@npm:4.0.0" + checksum: 10/c7617166e6291a15ce2982b5c4b9cdfb6409f5c14562712d12e2584480cdf18609694b21d7dad35b02df0fa2cd037505048ded54d2f405c64f600949564eb334 + languageName: node + linkType: hard + +"eslint@npm:^8.40.0": version: 8.57.0 resolution: "eslint@npm:8.57.0" dependencies: @@ -3616,6 +3624,61 @@ __metadata: languageName: node linkType: hard +"eslint@npm:^9.7.0": + version: 9.7.0 + resolution: "eslint@npm:9.7.0" + dependencies: + "@eslint-community/eslint-utils": "npm:^4.2.0" + "@eslint-community/regexpp": "npm:^4.11.0" + "@eslint/config-array": "npm:^0.17.0" + "@eslint/eslintrc": "npm:^3.1.0" + "@eslint/js": "npm:9.7.0" + "@humanwhocodes/module-importer": "npm:^1.0.1" + "@humanwhocodes/retry": "npm:^0.3.0" + "@nodelib/fs.walk": "npm:^1.2.8" + ajv: "npm:^6.12.4" + chalk: "npm:^4.0.0" + cross-spawn: "npm:^7.0.2" + debug: "npm:^4.3.2" + escape-string-regexp: "npm:^4.0.0" + eslint-scope: "npm:^8.0.2" + eslint-visitor-keys: "npm:^4.0.0" + espree: "npm:^10.1.0" + esquery: "npm:^1.5.0" + esutils: "npm:^2.0.2" + fast-deep-equal: "npm:^3.1.3" + file-entry-cache: "npm:^8.0.0" + find-up: "npm:^5.0.0" + glob-parent: "npm:^6.0.2" + ignore: "npm:^5.2.0" + imurmurhash: "npm:^0.1.4" + is-glob: "npm:^4.0.0" + is-path-inside: "npm:^3.0.3" + json-stable-stringify-without-jsonify: "npm:^1.0.1" + levn: "npm:^0.4.1" + lodash.merge: "npm:^4.6.2" + minimatch: "npm:^3.1.2" + natural-compare: "npm:^1.4.0" + optionator: "npm:^0.9.3" + strip-ansi: "npm:^6.0.1" + text-table: "npm:^0.2.0" + bin: + eslint: bin/eslint.js + checksum: 10/f9b3c99a63f1e94feadb2005d854c907d2a9322d14a0ad8a47a127562475bfdcc43fbffcae184e3de94d832218891bb4b7a21a914f7ef9e22b1d2ee19941368d + languageName: node + linkType: hard + +"espree@npm:^10.0.1, espree@npm:^10.1.0": + version: 10.1.0 + resolution: "espree@npm:10.1.0" + dependencies: + acorn: "npm:^8.12.0" + acorn-jsx: "npm:^5.3.2" + eslint-visitor-keys: "npm:^4.0.0" + checksum: 10/a673aa39a19a51763d92272f8f3772ae3d4b10624740bb72d5f273b631b43f1a5a32b385c1da6ae6bc10be05a5913bc4679ebd22a09c7b336a745204834806ea + languageName: node + linkType: hard + "espree@npm:^9.6.0, espree@npm:^9.6.1": version: 9.6.1 resolution: "espree@npm:9.6.1" @@ -3637,7 +3700,7 @@ __metadata: languageName: node linkType: hard -"esquery@npm:^1.4.2, esquery@npm:^1.6.0": +"esquery@npm:^1.4.2, esquery@npm:^1.5.0, esquery@npm:^1.6.0": version: 1.6.0 resolution: "esquery@npm:1.6.0" dependencies: @@ -3773,6 +3836,15 @@ __metadata: languageName: node linkType: hard +"file-entry-cache@npm:^8.0.0": + version: 8.0.0 + resolution: "file-entry-cache@npm:8.0.0" + dependencies: + flat-cache: "npm:^4.0.0" + checksum: 10/afe55c4de4e0d226a23c1eae62a7219aafb390859122608a89fa4df6addf55c7fd3f1a2da6f5b41e7cdff496e4cf28bbd215d53eab5c817afa96d2b40c81bfb0 + languageName: node + linkType: hard + "file-entry-cache@npm:^9.0.0": version: 9.0.0 resolution: "file-entry-cache@npm:9.0.0" @@ -3830,6 +3902,16 @@ __metadata: languageName: node linkType: hard +"flat-cache@npm:^4.0.0": + version: 4.0.1 + resolution: "flat-cache@npm:4.0.1" + dependencies: + flatted: "npm:^3.2.9" + keyv: "npm:^4.5.4" + checksum: 10/58ce851d9045fffc7871ce2bd718bc485ad7e777bf748c054904b87c351ff1080c2c11da00788d78738bfb51b71e4d5ea12d13b98eb36e3358851ffe495b62dc + languageName: node + linkType: hard + "flat-cache@npm:^5.0.0": version: 5.0.0 resolution: "flat-cache@npm:5.0.0" @@ -4064,6 +4146,13 @@ __metadata: languageName: node linkType: hard +"globals@npm:^14.0.0": + version: 14.0.0 + resolution: "globals@npm:14.0.0" + checksum: 10/03939c8af95c6df5014b137cac83aa909090c3a3985caef06ee9a5a669790877af8698ab38007e4c0186873adc14c0b13764acc754b16a754c216cc56aa5f021 + languageName: node + linkType: hard + "globals@npm:^15.0.0": version: 15.8.0 resolution: "globals@npm:15.8.0" @@ -6767,6 +6856,22 @@ __metadata: languageName: node linkType: hard +"typescript-eslint@npm:^7.17.0": + version: 7.17.0 + resolution: "typescript-eslint@npm:7.17.0" + dependencies: + "@typescript-eslint/eslint-plugin": "npm:7.17.0" + "@typescript-eslint/parser": "npm:7.17.0" + "@typescript-eslint/utils": "npm:7.17.0" + peerDependencies: + eslint: ^8.56.0 + peerDependenciesMeta: + typescript: + optional: true + checksum: 10/844591d50171cddc8ecb68820b541957fbabc05f30c09d758b93ea216214785fa67a08420e539feb70d542e532be88d3aa00573417dcce34ac5d1e5d57a19598 + languageName: node + linkType: hard + "typescript@npm:~5.5.4": version: 5.5.4 resolution: "typescript@npm:5.5.4"