diff --git a/package-lock.json b/package-lock.json index 4f252d2..afc1254 100644 --- a/package-lock.json +++ b/package-lock.json @@ -2647,26 +2647,6 @@ "node": "^12.0.0 || ^14.0.0 || >=16.0.0" } }, - "node_modules/@eslint/compat": { - "version": "2.0.2", - "resolved": "https://registry.npmjs.org/@eslint/compat/-/compat-2.0.2.tgz", - "integrity": "sha512-pR1DoD0h3HfF675QZx0xsyrsU8q70Z/plx7880NOhS02NuWLgBCOMDL787nUeQ7EWLkxv3bPQJaarjcPQb2Dwg==", - "license": "Apache-2.0", - "dependencies": { - "@eslint/core": "^1.1.0" - }, - "engines": { - "node": "^20.19.0 || ^22.13.0 || >=24" - }, - "peerDependencies": { - "eslint": "^8.40 || 9 || 10" - }, - "peerDependenciesMeta": { - "eslint": { - "optional": true - } - } - }, "node_modules/@eslint/config-array": { "version": "0.21.1", "resolved": "https://registry.npmjs.org/@eslint/config-array/-/config-array-0.21.1.tgz", @@ -2705,7 +2685,7 @@ "node": "^18.18.0 || ^20.9.0 || >=21.1.0" } }, - "node_modules/@eslint/config-helpers/node_modules/@eslint/core": { + "node_modules/@eslint/core": { "version": "0.17.0", "resolved": "https://registry.npmjs.org/@eslint/core/-/core-0.17.0.tgz", "integrity": "sha512-yL/sLrpmtDaFEiUj1osRP4TI2MDz1AddJL+jZ7KSqvBuliN4xqYY54IfdN8qD8Toa6g1iloph1fxQNkjOxrrpQ==", @@ -2717,18 +2697,6 @@ "node": "^18.18.0 || ^20.9.0 || >=21.1.0" } }, - "node_modules/@eslint/core": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/@eslint/core/-/core-1.1.0.tgz", - "integrity": "sha512-/nr9K9wkr3P1EzFTdFdMoLuo1PmIxjmwvPozwoSodjNBdefGujXQUF93u1DDZpEaTuDvMsIQddsd35BwtrW9Xw==", - "license": "Apache-2.0", - "dependencies": { - "@types/json-schema": "^7.0.15" - }, - "engines": { - "node": "^20.19.0 || ^22.13.0 || >=24" - } - }, "node_modules/@eslint/eslintrc": { "version": "3.3.3", "resolved": "https://registry.npmjs.org/@eslint/eslintrc/-/eslintrc-3.3.3.tgz", @@ -2810,18 +2778,6 @@ "node": "^18.18.0 || ^20.9.0 || >=21.1.0" } }, - "node_modules/@eslint/plugin-kit/node_modules/@eslint/core": { - "version": "0.17.0", - "resolved": "https://registry.npmjs.org/@eslint/core/-/core-0.17.0.tgz", - "integrity": "sha512-yL/sLrpmtDaFEiUj1osRP4TI2MDz1AddJL+jZ7KSqvBuliN4xqYY54IfdN8qD8Toa6g1iloph1fxQNkjOxrrpQ==", - "license": "Apache-2.0", - "dependencies": { - "@types/json-schema": "^7.0.15" - }, - "engines": { - "node": "^18.18.0 || ^20.9.0 || >=21.1.0" - } - }, "node_modules/@humanfs/core": { "version": "0.19.1", "resolved": "https://registry.npmjs.org/@humanfs/core/-/core-0.19.1.tgz", @@ -10594,21 +10550,6 @@ "url": "https://opencollective.com/eslint" } }, - "node_modules/eslint-config-prettier": { - "version": "10.1.8", - "resolved": "https://registry.npmjs.org/eslint-config-prettier/-/eslint-config-prettier-10.1.8.tgz", - "integrity": "sha512-82GZUjRS0p/jganf6q1rEO25VSoHH0hKPCTrgillPjdI/3bgBhAE1QzHrHTizjpRvy6pGAvKjDJtk2pF9NDq8w==", - "license": "MIT", - "bin": { - "eslint-config-prettier": "bin/cli.js" - }, - "funding": { - "url": "https://opencollective.com/eslint-config-prettier" - }, - "peerDependencies": { - "eslint": ">=7.0.0" - } - }, "node_modules/eslint-import-context": { "version": "0.1.9", "resolved": "https://registry.npmjs.org/eslint-import-context/-/eslint-import-context-0.1.9.tgz", @@ -22416,18 +22357,140 @@ "license": "ISC", "dependencies": { "@babel/preset-react": "^7.28.5", - "@eslint/compat": "^2.0.2", - "@eslint/eslintrc": "^3.3.3", - "@eslint/js": "^9.39.1", "@typescript-eslint/eslint-plugin": "^8.56.0", "@wordpress/eslint-plugin": "^24.2.0", - "eslint-config-prettier": "^10.1.8", + "eslint": "^9.39.2", "eslint-import-resolver-alias": "^1.1.2", "eslint-plugin-import": "^2.32.0", + "eslint-plugin-prettier": "^5.5.5", "eslint-plugin-react-hooks": "^7.0.1", "globals": "^17.3.0" } }, + "packages/eslint-config/node_modules/eslint": { + "version": "9.39.2", + "resolved": "https://registry.npmjs.org/eslint/-/eslint-9.39.2.tgz", + "integrity": "sha512-LEyamqS7W5HB3ujJyvi0HQK/dtVINZvd5mAAp9eT5S/ujByGjiZLCzPcHVzuXbpJDJF/cxwHlfceVUDZ2lnSTw==", + "license": "MIT", + "dependencies": { + "@eslint-community/eslint-utils": "^4.8.0", + "@eslint-community/regexpp": "^4.12.1", + "@eslint/config-array": "^0.21.1", + "@eslint/config-helpers": "^0.4.2", + "@eslint/core": "^0.17.0", + "@eslint/eslintrc": "^3.3.1", + "@eslint/js": "9.39.2", + "@eslint/plugin-kit": "^0.4.1", + "@humanfs/node": "^0.16.6", + "@humanwhocodes/module-importer": "^1.0.1", + "@humanwhocodes/retry": "^0.4.2", + "@types/estree": "^1.0.6", + "ajv": "^6.12.4", + "chalk": "^4.0.0", + "cross-spawn": "^7.0.6", + "debug": "^4.3.2", + "escape-string-regexp": "^4.0.0", + "eslint-scope": "^8.4.0", + "eslint-visitor-keys": "^4.2.1", + "espree": "^10.4.0", + "esquery": "^1.5.0", + "esutils": "^2.0.2", + "fast-deep-equal": "^3.1.3", + "file-entry-cache": "^8.0.0", + "find-up": "^5.0.0", + "glob-parent": "^6.0.2", + "ignore": "^5.2.0", + "imurmurhash": "^0.1.4", + "is-glob": "^4.0.0", + "json-stable-stringify-without-jsonify": "^1.0.1", + "lodash.merge": "^4.6.2", + "minimatch": "^3.1.2", + "natural-compare": "^1.4.0", + "optionator": "^0.9.3" + }, + "bin": { + "eslint": "bin/eslint.js" + }, + "engines": { + "node": "^18.18.0 || ^20.9.0 || >=21.1.0" + }, + "funding": { + "url": "https://eslint.org/donate" + }, + "peerDependencies": { + "jiti": "*" + }, + "peerDependenciesMeta": { + "jiti": { + "optional": true + } + } + }, + "packages/eslint-config/node_modules/eslint-scope": { + "version": "8.4.0", + "resolved": "https://registry.npmjs.org/eslint-scope/-/eslint-scope-8.4.0.tgz", + "integrity": "sha512-sNXOfKCn74rt8RICKMvJS7XKV/Xk9kA7DyJr8mJik3S7Cwgy3qlkkmyS2uQB3jiJg6VNdZd/pDBJu0nvG2NlTg==", + "license": "BSD-2-Clause", + "dependencies": { + "esrecurse": "^4.3.0", + "estraverse": "^5.2.0" + }, + "engines": { + "node": "^18.18.0 || ^20.9.0 || >=21.1.0" + }, + "funding": { + "url": "https://opencollective.com/eslint" + } + }, + "packages/eslint-config/node_modules/eslint-visitor-keys": { + "version": "4.2.1", + "resolved": "https://registry.npmjs.org/eslint-visitor-keys/-/eslint-visitor-keys-4.2.1.tgz", + "integrity": "sha512-Uhdk5sfqcee/9H/rCOJikYz67o0a2Tw2hGRPOG2Y1R2dg7brRe1uG0yaNQDHu+TO/uQPF/5eCapvYSmHUjt7JQ==", + "license": "Apache-2.0", + "engines": { + "node": "^18.18.0 || ^20.9.0 || >=21.1.0" + }, + "funding": { + "url": "https://opencollective.com/eslint" + } + }, + "packages/eslint-config/node_modules/file-entry-cache": { + "version": "8.0.0", + "resolved": "https://registry.npmjs.org/file-entry-cache/-/file-entry-cache-8.0.0.tgz", + "integrity": "sha512-XXTUwCvisa5oacNGRP9SfNtYBNAMi+RPwBFmblZEF7N7swHYQS6/Zfk7SRwx4D5j3CH211YNRco1DEMNVfZCnQ==", + "license": "MIT", + "dependencies": { + "flat-cache": "^4.0.0" + }, + "engines": { + "node": ">=16.0.0" + } + }, + "packages/eslint-config/node_modules/flat-cache": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/flat-cache/-/flat-cache-4.0.1.tgz", + "integrity": "sha512-f7ccFPK3SXFHpx15UIGyRJ/FJQctuKZ0zVuN3frBo4HnK3cay9VEW0R6yPYFHC0AgqhukPzKjq22t5DmAyqGyw==", + "license": "MIT", + "dependencies": { + "flatted": "^3.2.9", + "keyv": "^4.5.4" + }, + "engines": { + "node": ">=16" + } + }, + "packages/eslint-config/node_modules/minimatch": { + "version": "3.1.2", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.2.tgz", + "integrity": "sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw==", + "license": "ISC", + "dependencies": { + "brace-expansion": "^1.1.7" + }, + "engines": { + "node": "*" + } + }, "packages/postcss-config": { "name": "@yardinternet/postcss-config", "version": "2.1.2", @@ -22860,9 +22923,6 @@ "license": "ISC", "dependencies": { "@babel/preset-react": "^7.28.5", - "@eslint/compat": "^2.0.2", - "@eslint/eslintrc": "^3.3.3", - "@eslint/js": "^9.39.1", "@shufo/prettier-plugin-blade": "^1.16.1", "@shufo/tailwindcss-class-sorter": "^3.0.1", "@typescript-eslint/eslint-plugin": "^8.56.0", @@ -22870,9 +22930,9 @@ "@wordpress/prettier-config": "^4.40.0", "chalk": "^5.6.2", "eslint": "^9.39.1", - "eslint-config-prettier": "^10.1.8", "eslint-import-resolver-alias": "^1.1.2", "eslint-plugin-import": "^2.32.0", + "eslint-plugin-prettier": "^5.5.5", "eslint-plugin-react-hooks": "^7.0.1", "globals": "^17.3.0", "globby": "^16.1.1", @@ -23002,18 +23062,6 @@ "postcss-selector-parser": "^7.1.1" } }, - "packages/toolkit/node_modules/@eslint/core": { - "version": "0.17.0", - "resolved": "https://registry.npmjs.org/@eslint/core/-/core-0.17.0.tgz", - "integrity": "sha512-yL/sLrpmtDaFEiUj1osRP4TI2MDz1AddJL+jZ7KSqvBuliN4xqYY54IfdN8qD8Toa6g1iloph1fxQNkjOxrrpQ==", - "license": "Apache-2.0", - "dependencies": { - "@types/json-schema": "^7.0.15" - }, - "engines": { - "node": "^18.18.0 || ^20.9.0 || >=21.1.0" - } - }, "packages/toolkit/node_modules/ansi-regex": { "version": "6.2.2", "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-6.2.2.tgz", diff --git a/package.json b/package.json index 4daeb96..f5a8aa5 100644 --- a/package.json +++ b/package.json @@ -20,8 +20,8 @@ "scripts": { "lint:js": "yard-toolkit lint js -m custom ./packages/**/src/**/*.js", "format:js": "yard-toolkit format js -m custom ./packages/**/*.js", - "dep:check": "syncpack list-mismatches", - "dep:fix": "syncpack fix-mismatches", + "dep:check": "syncpack lint", + "dep:fix": "syncpack fix", "dep:outdated": "npm outdated --workspaces", "dep:update": "ncu --deep -u && npm install", "prepare": "husky" diff --git a/packages/eslint-config/README.md b/packages/eslint-config/README.md index 313258c..8dc14d2 100644 --- a/packages/eslint-config/README.md +++ b/packages/eslint-config/README.md @@ -10,23 +10,21 @@ npm i @yardinternet/eslint-config ## Usage -`@yardinternet/eslint-config` can be required in the `.eslint.config.js` +`@yardinternet/eslint-config` can be required in the `.eslint.config.cjs` ```js module.exports = require('@yardinternet/eslint-config'); ``` - -If you want to add or override settings you can use tools like [deepmerge](https://www.npmjs.com/package/deepmerge). +You can merge or override rules by spreading this config and adding your own objects: ```js -const merge = require('deepmerge'); -const eslintSettings = merge(require('@yardinternet/eslint-config'), [ +module.exports = [ + ...require('@yardinternet/eslint-config'), { rules: { + // Your overrides here "jsdoc/require-param": 0, }, }, -]) - -module.exports = eslintSettings; +]; ``` diff --git a/packages/eslint-config/package.json b/packages/eslint-config/package.json index e6d2961..b0d8057 100644 --- a/packages/eslint-config/package.json +++ b/packages/eslint-config/package.json @@ -19,14 +19,12 @@ "license": "ISC", "dependencies": { "@babel/preset-react": "^7.28.5", - "@eslint/compat": "^2.0.2", - "@eslint/eslintrc": "^3.3.3", - "@eslint/js": "^9.39.1", "@typescript-eslint/eslint-plugin": "^8.56.0", "@wordpress/eslint-plugin": "^24.2.0", - "eslint-config-prettier": "^10.1.8", + "eslint": "^9.39.2", "eslint-import-resolver-alias": "^1.1.2", "eslint-plugin-import": "^2.32.0", + "eslint-plugin-prettier": "^5.5.5", "eslint-plugin-react-hooks": "^7.0.1", "globals": "^17.3.0" } diff --git a/packages/eslint-config/src/index.js b/packages/eslint-config/src/index.js index 81bade1..444937b 100644 --- a/packages/eslint-config/src/index.js +++ b/packages/eslint-config/src/index.js @@ -1,73 +1,65 @@ -const globals = require( 'globals' ); -const babelParser = require( '@babel/eslint-parser' ); -const { fixupConfigRules } = require( '@eslint/compat' ); -const js = require( '@eslint/js' ); -const { FlatCompat } = require( '@eslint/eslintrc' ); +const { defineConfig } = require("eslint/config"); +const wordpressPlugin = require('@wordpress/eslint-plugin'); +const prettierPlugin = require('eslint-plugin-prettier'); +const importPlugin = require('eslint-plugin-import'); +const globals = require('globals'); +const babelParser = require('@babel/eslint-parser'); -const compat = new FlatCompat( { - baseDirectory: __dirname, - recommendedConfig: js.configs.recommended, - allConfig: js.configs.all, -} ); - -module.exports = [ - ...fixupConfigRules( - compat.extends( - 'plugin:@wordpress/eslint-plugin/recommended', - 'prettier' - ) - ), - { - files: [ '**/*.js', '**/*.jsx', '**/*.ts', '**/*.tsx' ], - languageOptions: { - globals: { - ...globals.browser, - ...globals.node, - CLI: 'readonly', - wp: 'readonly', - }, - - parser: babelParser, - - parserOptions: { - requireConfigFile: false, - - babelOptions: { - presets: [ '@babel/preset-react' ], - }, - ecmaFeatures: { - jsx: true, - }, - }, - }, - - rules: { - 'prettier/prettier': 0, - 'jsdoc/require-param': 0, - 'no-unused-expressions': [ - 'error', - { - allowTernary: true, - }, - ], - 'import/no-unresolved': [ - 'error', - { ignore: ['^@wordpress/'] }, - ], - }, - - settings: { - react: { - version: '19.0', - }, - 'import/resolver': { - alias: [ - [ - '@sage/scripts', - './web/app/themes/sage/resources/scripts', - ], - ], - }, - }, - }, -]; +module.exports = defineConfig([ + { + files: [ '**/*.js', '**/*.jsx', '**/*.ts', '**/*.tsx' ], + plugins: { + '@wordpress': wordpressPlugin, + prettier: prettierPlugin, + import: importPlugin, + }, + languageOptions: { + globals: { + ...globals.browser, + ...globals.node, + CLI: 'readonly', + wp: 'readonly', + }, + parser: babelParser, + parserOptions: { + requireConfigFile: false, + babelOptions: { + presets: [ '@babel/preset-react' ], + }, + ecmaFeatures: { + jsx: true, + }, + ecmaVersion: 2022, + sourceType: 'module', + }, + }, + rules: { + ...wordpressPlugin.configs.recommended.rules, + 'prettier/prettier': 'error', + 'jsdoc/require-param': 0, + 'no-unused-expressions': [ + 'error', + { + allowTernary: true, + }, + ], + 'import/no-unresolved': [ + 'error', + { ignore: ['^@wordpress/'] }, + ], + }, + settings: { + react: { + version: '19.0', + }, + 'import/resolver': { + alias: [ + [ + '@sage/scripts', + './web/app/themes/sage/resources/scripts', + ], + ], + }, + }, + }, +]); diff --git a/packages/toolkit/package.json b/packages/toolkit/package.json index ab8b94d..fad7529 100644 --- a/packages/toolkit/package.json +++ b/packages/toolkit/package.json @@ -21,19 +21,16 @@ "license": "ISC", "dependencies": { "@babel/preset-react": "^7.28.5", - "@eslint/compat": "^2.0.2", - "@eslint/eslintrc": "^3.3.3", - "@eslint/js": "^9.39.1", "@shufo/prettier-plugin-blade": "^1.16.1", "@shufo/tailwindcss-class-sorter": "^3.0.1", "@typescript-eslint/eslint-plugin": "^8.56.0", "@wordpress/eslint-plugin": "^24.2.0", "@wordpress/prettier-config": "^4.40.0", "chalk": "^5.6.2", - "eslint": "^9.39.1", - "eslint-config-prettier": "^10.1.8", + "eslint": "^9.39.2", "eslint-import-resolver-alias": "^1.1.2", "eslint-plugin-import": "^2.32.0", + "eslint-plugin-prettier": "^5.5.5", "eslint-plugin-react-hooks": "^7.0.1", "globals": "^17.3.0", "globby": "^16.1.1",