diff --git a/.eslintrc.js b/.eslintrc.js deleted file mode 100644 index 43fc4de85136..000000000000 --- a/.eslintrc.js +++ /dev/null @@ -1,206 +0,0 @@ -/* - Note to future self: - - If ESLint is ever extremely slow again, check if there are .js and/or .map files in the source directories - and delete them: - - ```bash - find . -type f -name "*.map" | grep ./packages | grep /src/ | xargs -n1 rm - find . -type f -name "*.js" | grep ./packages | grep /src/ | xargs -n1 rm - ``` - - Running `TIMING=1 DEBUG=eslint:cli-engine yarn run lint:ts` helps detect the problem -*/ - -module.exports = { - root: true, - parser: "@typescript-eslint/parser", // Specifies the ESLint parser - parserOptions: { - ecmaVersion: 2023, // Allows for the parsing of modern ECMAScript features - sourceType: "module", // Allows for the use of imports - project: "./tsconfig.eslint.json", - tsconfigRootDir: __dirname, - }, - extends: [ - // Use the recommended rules from the @typescript-eslint/eslint-plugin - "plugin:@typescript-eslint/recommended", - "plugin:@typescript-eslint/recommended-requiring-type-checking", - ], - plugins: [ - "deprecation", - "unused-imports", - "unicorn", - "@zwave-js", - ], - reportUnusedDisableDirectives: true, - rules: { - // Place to specify ESLint rules. Can be used to overwrite rules specified from the extended configs - "@typescript-eslint/no-parameter-properties": "off", - "@typescript-eslint/no-explicit-any": "off", - "@typescript-eslint/no-use-before-define": [ - "error", - { - functions: false, - typedefs: false, - classes: false, - }, - ], - "@typescript-eslint/no-unused-vars": [ - "error", - { - ignoreRestSiblings: true, - argsIgnorePattern: "^_", - }, - ], - "@typescript-eslint/no-object-literal-type-assertion": "off", - "@typescript-eslint/interface-name-prefix": "off", - "@typescript-eslint/no-non-null-assertion": "off", // This is necessary for Map.has()/get()! - "@typescript-eslint/no-inferrable-types": [ - "error", - { - ignoreProperties: true, - ignoreParameters: true, - }, - ], - "@typescript-eslint/ban-ts-comment": [ - "error", - { - "ts-expect-error": false, - "ts-ignore": true, - "ts-nocheck": true, - "ts-check": false, - }, - ], - "@typescript-eslint/restrict-template-expressions": [ - "error", - { - allowNumber: true, - allowBoolean: true, - // This is necessary to log errors - // TODO: Consider switching to false when we may annotate catch clauses - allowAny: true, - allowNullish: true, - }, - ], - "@typescript-eslint/no-misused-promises": [ - "error", - { - checksVoidReturn: false, - }, - ], - - // Make sure type imports are used where necessary - "@typescript-eslint/consistent-type-imports": [ - "error", - { - fixStyle: "inline-type-imports", - disallowTypeAnnotations: false, - }, - ], - "@typescript-eslint/consistent-type-exports": "error", - - // We can turn this on from time to time but in general these rules - // make our lives harder instead of easier - "@typescript-eslint/no-unsafe-argument": "off", - "@typescript-eslint/no-unsafe-assignment": "off", - "@typescript-eslint/no-unsafe-member-access": "off", - "@typescript-eslint/no-unsafe-return": "off", - "@typescript-eslint/no-unsafe-call": "off", - "@typescript-eslint/no-unsafe-enum-comparison": "off", - "@typescript-eslint/no-unsafe-declaration-merging": "off", - - // Although this rule makes sense, it takes about a second to execute (and we don't need it) - "@typescript-eslint/no-implied-eval": "off", - - "@typescript-eslint/explicit-module-boundary-types": [ - "warn", - { allowArgumentsExplicitlyTypedAsAny: true }, - ], - "@typescript-eslint/no-this-alias": "off", - - // Prefer simple property access and declaration without quotes - "dot-notation": "off", - "@typescript-eslint/dot-notation": [ - "error", - { - allowPrivateClassPropertyAccess: true, - allowProtectedClassPropertyAccess: true, - }, - ], - "quote-props": ["error", "as-needed"], - "deprecation/deprecation": "error", - "unused-imports/no-unused-imports-ts": "error", - "unused-imports/no-unused-imports": "error", - - "unicorn/prefer-array-find": ["error", { checkFromLast: true }], - "unicorn/prefer-array-flat-map": "error", - "unicorn/prefer-array-flat": "error", - "unicorn/prefer-array-index-of": "error", - "unicorn/prefer-array-some": "error", - "unicorn/prefer-at": "error", - "unicorn/prefer-includes": "error", - "unicorn/prefer-logical-operator-over-ternary": "error", - "unicorn/prefer-modern-math-apis": "error", - "unicorn/prefer-negative-index": "error", - "unicorn/prefer-node-protocol": "error", - "unicorn/prefer-regexp-test": "error", - "unicorn/prefer-string-slice": "error", - "unicorn/prefer-string-starts-ends-with": "error", - "unicorn/prefer-string-replace-all": "error", - }, - overrides: [ - { - files: ["*.test.ts", "*.test.ava.ts"], - rules: { - "@typescript-eslint/explicit-function-return-type": "off", - "@typescript-eslint/no-empty-function": "off", - "@typescript-eslint/ban-ts-comment": "off", - "@typescript-eslint/no-unsafe-argument": "off", - "@typescript-eslint/no-unsafe-assignment": "off", - "@typescript-eslint/no-unsafe-member-access": "off", - "@typescript-eslint/no-unsafe-member-return": "off", - "@typescript-eslint/no-unsafe-return": "off", - "@typescript-eslint/no-unsafe-call": "off", - "@typescript-eslint/no-floating-promises": "off", - "@typescript-eslint/require-await": "off", - "@typescript-eslint/unbound-method": "off", - "@typescript-eslint/no-unused-vars": "off", - "@typescript-eslint/dot-notation": "off", - - "@zwave-js/no-debug-in-tests": "error", - }, - }, - { - files: ["*.js"], - rules: { - "@typescript-eslint/*": "off", - }, - }, - { - files: ["packages/cc/src/**/*CC.ts"], - rules: { - "@zwave-js/ccapi-validate-args": "error", - "@zwave-js/no-internal-cc-types": "error", - }, - }, - { - files: ["packages/cc/src/**"], - rules: { - "@zwave-js/consistent-cc-classes": "error", - }, - }, - { - files: ["packages/**/*.ts"], - rules: { - "@zwave-js/no-forbidden-imports": "error", - }, - }, - { - files: ["packages/config/config/devices/**/*.json"], - parser: "jsonc-eslint-parser", - rules: { - "@zwave-js/consistent-device-configs": "error", - }, - }, - ], -}; diff --git a/eslint.config.js b/eslint.config.js new file mode 100644 index 000000000000..4e071b872950 --- /dev/null +++ b/eslint.config.js @@ -0,0 +1,217 @@ +/* + Note to future self: + + If ESLint is ever extremely slow again, check if there are .js and/or .map files in the source directories + and delete them: + + ```bash + find . -type f -name "*.map" | grep ./packages | grep /src/ | xargs -n1 rm + find . -type f -name "*.js" | grep ./packages | grep /src/ | xargs -n1 rm + ``` + + Running `TIMING=1 DEBUG=eslint:cli-engine yarn run lint:ts` helps detect the problem +*/ + +// @ts-check + +import tseslint from "typescript-eslint"; +import deprecation from "eslint-plugin-deprecation"; +import unusedImports from "eslint-plugin-unused-imports"; +import unicorn from "eslint-plugin-unicorn"; +import zjs from "@zwave-js/eslint-plugin"; +import jsonc from "jsonc-eslint-parser"; + +export default tseslint.config( + ...tseslint.configs.recommended, + ...tseslint.configs.recommendedTypeChecked, + { + languageOptions: { + parserOptions: { + project: "./tsconfig.eslint.json", + }, + }, + linterOptions: { + reportUnusedDisableDirectives: true, + }, + plugins: { + deprecation, + "unused-imports": unusedImports, + unicorn, + "@zwave-js": zjs, + }, + rules: { + // Place to specify ESLint rules. Can be used to overwrite rules specified from the extended configs + "@typescript-eslint/no-parameter-properties": "off", + "@typescript-eslint/no-explicit-any": "off", + "@typescript-eslint/no-use-before-define": [ + "error", + { + functions: false, + typedefs: false, + classes: false, + }, + ], + "@typescript-eslint/no-unused-vars": [ + "error", + { + ignoreRestSiblings: true, + argsIgnorePattern: "^_", + }, + ], + "@typescript-eslint/no-object-literal-type-assertion": "off", + "@typescript-eslint/interface-name-prefix": "off", + "@typescript-eslint/no-non-null-assertion": "off", // This is necessary for Map.has()/get()! + "@typescript-eslint/no-inferrable-types": [ + "error", + { + ignoreProperties: true, + ignoreParameters: true, + }, + ], + "@typescript-eslint/ban-ts-comment": [ + "error", + { + "ts-expect-error": false, + "ts-ignore": true, + "ts-nocheck": true, + "ts-check": false, + }, + ], + "@typescript-eslint/restrict-template-expressions": [ + "error", + { + allowNumber: true, + allowBoolean: true, + // This is necessary to log errors + // TODO: Consider switching to false when we may annotate catch clauses + allowAny: true, + allowNullish: true, + }, + ], + "@typescript-eslint/no-misused-promises": [ + "error", + { + checksVoidReturn: false, + }, + ], + + // Make sure type imports are used where necessary + "@typescript-eslint/consistent-type-imports": [ + "error", + { + fixStyle: "inline-type-imports", + disallowTypeAnnotations: false, + }, + ], + "@typescript-eslint/consistent-type-exports": "error", + + // We can turn this on from time to time but in general these rules + // make our lives harder instead of easier + "@typescript-eslint/no-unsafe-argument": "off", + "@typescript-eslint/no-unsafe-assignment": "off", + "@typescript-eslint/no-unsafe-member-access": "off", + "@typescript-eslint/no-unsafe-return": "off", + "@typescript-eslint/no-unsafe-call": "off", + "@typescript-eslint/no-unsafe-enum-comparison": "off", + "@typescript-eslint/no-unsafe-declaration-merging": "off", + + // Although this rule makes sense, it takes about a second to execute (and we don't need it) + "@typescript-eslint/no-implied-eval": "off", + + "@typescript-eslint/explicit-module-boundary-types": [ + "warn", + { allowArgumentsExplicitlyTypedAsAny: true }, + ], + "@typescript-eslint/no-this-alias": "off", + + // Prefer simple property access and declaration without quotes + "dot-notation": "off", + "@typescript-eslint/dot-notation": [ + "error", + { + allowPrivateClassPropertyAccess: true, + allowProtectedClassPropertyAccess: true, + }, + ], + "quote-props": ["error", "as-needed"], + "deprecation/deprecation": "error", + "unused-imports/no-unused-imports-ts": "error", + "unused-imports/no-unused-imports": "error", + + "unicorn/prefer-array-find": ["error", { checkFromLast: true }], + "unicorn/prefer-array-flat-map": "error", + "unicorn/prefer-array-flat": "error", + "unicorn/prefer-array-index-of": "error", + "unicorn/prefer-array-some": "error", + "unicorn/prefer-at": "error", + "unicorn/prefer-includes": "error", + "unicorn/prefer-logical-operator-over-ternary": "error", + "unicorn/prefer-modern-math-apis": "error", + "unicorn/prefer-negative-index": "error", + "unicorn/prefer-node-protocol": "error", + "unicorn/prefer-regexp-test": "error", + "unicorn/prefer-string-slice": "error", + "unicorn/prefer-string-starts-ends-with": "error", + "unicorn/prefer-string-replace-all": "error", + }, + }, + // Disable unnecessarily strict rules for test files + { + files: ["*.test.ts", "*.test.ava.ts"], + rules: { + "@typescript-eslint/explicit-function-return-type": "off", + "@typescript-eslint/no-empty-function": "off", + "@typescript-eslint/ban-ts-comment": "off", + "@typescript-eslint/no-unsafe-argument": "off", + "@typescript-eslint/no-unsafe-assignment": "off", + "@typescript-eslint/no-unsafe-member-access": "off", + "@typescript-eslint/no-unsafe-member-return": "off", + "@typescript-eslint/no-unsafe-return": "off", + "@typescript-eslint/no-unsafe-call": "off", + "@typescript-eslint/no-floating-promises": "off", + "@typescript-eslint/require-await": "off", + "@typescript-eslint/unbound-method": "off", + "@typescript-eslint/no-unused-vars": "off", + "@typescript-eslint/dot-notation": "off", + + "@zwave-js/no-debug-in-tests": "error", + }, + }, + // Disable all TS-related rules for JS files + { + files: ["*.js"], + rules: { + "@typescript-eslint/*": "off", + }, + }, + // Enable rules from the local plugin for relevant files + { + files: ["packages/cc/src/**/*CC.ts"], + rules: { + "@zwave-js/ccapi-validate-args": "error", + "@zwave-js/no-internal-cc-types": "error", + }, + }, + { + files: ["packages/cc/src/**"], + rules: { + "@zwave-js/consistent-cc-classes": "error", + }, + }, + { + files: ["packages/**/*.ts"], + rules: { + "@zwave-js/no-forbidden-imports": "error", + }, + }, + { + files: ["packages/config/config/devices/**/*.json"], + ...zjs.configs.co + languageOptions: { + parser: jsonc, + }, + rules: { + "@zwave-js/consistent-device-configs": "error", + }, + } +); diff --git a/package.json b/package.json index e836769144d1..4ff1c269e9da 100644 --- a/package.json +++ b/package.json @@ -47,8 +47,6 @@ "@types/node": "^18.19.31", "@types/semver": "^7.5.8", "@types/source-map-support": "^0.5.10", - "@typescript-eslint/eslint-plugin": "^7.13.0", - "@typescript-eslint/parser": "^7.13.0", "@zwave-js/cc": "workspace:*", "@zwave-js/config": "workspace:*", "@zwave-js/core": "workspace:*", @@ -88,6 +86,7 @@ "ts-patch": "3.2.1", "turbo": "1.7.4", "typescript": "5.5.3", + "typescript-eslint": "^7.16.0", "zwave-js": "workspace:*" }, "resolutions": { diff --git a/packages/eslint-plugin/package.json b/packages/eslint-plugin/package.json index 05c1e97051e4..3042268568cd 100644 --- a/packages/eslint-plugin/package.json +++ b/packages/eslint-plugin/package.json @@ -4,7 +4,8 @@ "description": "zwave-js: custom ESLint rules", "private": true, "keywords": [], - "main": "build/index.js", + "type": "module", + "module": "build/index.js", "files": [ "build/**/*.js" ], @@ -35,7 +36,7 @@ "lint:ts:fix": "yarn run lint:ts --fix" }, "devDependencies": { - "@types/eslint": "^8.56.7", + "@types/eslint": "^8.56.10", "@typescript-eslint/utils": "^7.13.0", "@zwave-js/core": "workspace:*", "eslint": "^8.57.0", diff --git a/packages/eslint-plugin/src/configs/configFiles.ts b/packages/eslint-plugin/src/configs/configFiles.ts index d9aa048a5960..8860271e8e1b 100644 --- a/packages/eslint-plugin/src/configs/configFiles.ts +++ b/packages/eslint-plugin/src/configs/configFiles.ts @@ -1,10 +1,14 @@ -import { type ESLint } from "eslint"; +import { Linter } from "eslint"; +import jsoncParser from "jsonc-eslint-parser"; +import zjs from "../index.js"; -export const configFiles: ESLint.ConfigData = { - parser: "jsonc-eslint-parser", - plugins: [ - "@zwave-js", - ], +export const configFiles: Linter.FlatConfig = { + languageOptions: { + parser: jsoncParser, + }, + plugins: { + "@zwave-js": zjs, + }, rules: { "@zwave-js/auto-unsigned": "error", "@zwave-js/consistent-config-string-case": "error", diff --git a/packages/eslint-plugin/src/index.ts b/packages/eslint-plugin/src/index.ts index 1a4bf1c4634f..787d63c05847 100644 --- a/packages/eslint-plugin/src/index.ts +++ b/packages/eslint-plugin/src/index.ts @@ -16,7 +16,7 @@ import { preferDefaultValue } from "./rules/prefer-defaultvalue.js"; import { configFiles as configFilesConfig } from "./configs/configFiles.js"; import { noInternalCCTypes } from "./rules/no-internal-cc-types.js"; -module.exports = { +export default { rules: { "auto-unsigned": autoUnsigned, "ccapi-validate-args": ccAPIValidateArgs, diff --git a/packages/eslint-plugin/src/rules/auto-unsigned.ts b/packages/eslint-plugin/src/rules/auto-unsigned.ts index 689b35932d41..3beeced55063 100644 --- a/packages/eslint-plugin/src/rules/auto-unsigned.ts +++ b/packages/eslint-plugin/src/rules/auto-unsigned.ts @@ -9,7 +9,7 @@ import { insertBeforeJSONProperty, paramInfoPropertyOrder, removeJSONProperty, -} from "../utils"; +} from "../utils.js"; export const autoUnsigned: JSONCRule.RuleModule = { create(context) { diff --git a/packages/eslint-plugin/src/rules/ccapi-validate-args.ts b/packages/eslint-plugin/src/rules/ccapi-validate-args.ts index e3a9e0414891..0546eab11d45 100644 --- a/packages/eslint-plugin/src/rules/ccapi-validate-args.ts +++ b/packages/eslint-plugin/src/rules/ccapi-validate-args.ts @@ -7,7 +7,7 @@ import { type Rule, findDecoratorContainingCCId, getCCNameFromDecorator, -} from "../utils"; +} from "../utils.js"; const isFixMode = process.argv.some((arg) => arg.startsWith("--fix")); diff --git a/packages/eslint-plugin/src/rules/consistent-cc-classes.ts b/packages/eslint-plugin/src/rules/consistent-cc-classes.ts index e4b889b73f70..2db8230635ae 100644 --- a/packages/eslint-plugin/src/rules/consistent-cc-classes.ts +++ b/packages/eslint-plugin/src/rules/consistent-cc-classes.ts @@ -11,7 +11,7 @@ import { findDecoratorContainingCCId, getCCIdFromDecorator, getCCIdFromExpression, -} from "../utils"; +} from "../utils.js"; const apiBaseClasses = new Set(["CCAPI", "PhysicalCCAPI"]); diff --git a/packages/eslint-plugin/src/rules/consistent-config-string-case.ts b/packages/eslint-plugin/src/rules/consistent-config-string-case.ts index 6cce4f82faae..477432e25d00 100644 --- a/packages/eslint-plugin/src/rules/consistent-config-string-case.ts +++ b/packages/eslint-plugin/src/rules/consistent-config-string-case.ts @@ -1,11 +1,11 @@ import { type AST } from "jsonc-eslint-parser"; -import { CONFIG_OPTION, CONFIG_PARAM, ROOT } from "../jsonSelectors"; +import { CONFIG_OPTION, CONFIG_PARAM, ROOT } from "../jsonSelectors.js"; import { type JSONCRule, insertAfterJSONProperty, insertBeforeJSONProperty, -} from "../utils"; -import { toSentenceCase, toTitleCase } from "../utils/titleAndSentenceCase"; +} from "../utils.js"; +import { toSentenceCase, toTitleCase } from "../utils/titleAndSentenceCase.js"; // TODO: Avoid Enable/Disable in param labels // remove Z-Wave and all its variants diff --git a/packages/eslint-plugin/src/rules/consistent-device-config-property-order.ts b/packages/eslint-plugin/src/rules/consistent-device-config-property-order.ts index e712034e4400..52f452984081 100644 --- a/packages/eslint-plugin/src/rules/consistent-device-config-property-order.ts +++ b/packages/eslint-plugin/src/rules/consistent-device-config-property-order.ts @@ -1,6 +1,6 @@ import { type AST as ESLintAST } from "eslint"; import type { AST } from "jsonc-eslint-parser"; -import { type JSONCRule, paramInfoPropertyOrder } from "../utils"; +import { type JSONCRule, paramInfoPropertyOrder } from "../utils.js"; export const consistentDeviceConfigPropertyOrder: JSONCRule.RuleModule = { create(context) { diff --git a/packages/eslint-plugin/src/rules/consistent-param-units.ts b/packages/eslint-plugin/src/rules/consistent-param-units.ts index 4cc95add12ee..8967671d21c7 100644 --- a/packages/eslint-plugin/src/rules/consistent-param-units.ts +++ b/packages/eslint-plugin/src/rules/consistent-param-units.ts @@ -1,6 +1,6 @@ import type { AST } from "jsonc-eslint-parser"; -import { CONFIG_PARAM } from "../jsonSelectors"; -import { type JSONCRule } from "../utils"; +import { CONFIG_PARAM } from "../jsonSelectors.js"; +import { type JSONCRule } from "../utils.js"; interface FixableUnit { wrong: string[]; diff --git a/packages/eslint-plugin/src/rules/no-forbidden-imports.ts b/packages/eslint-plugin/src/rules/no-forbidden-imports.ts index b5d659edd169..17e1e887c1b0 100644 --- a/packages/eslint-plugin/src/rules/no-forbidden-imports.ts +++ b/packages/eslint-plugin/src/rules/no-forbidden-imports.ts @@ -2,7 +2,7 @@ import { ESLintUtils, type TSESTree } from "@typescript-eslint/utils"; import fs from "node:fs"; import path from "node:path"; import ts from "typescript"; -import { type Rule } from "../utils"; +import { type Rule } from "../utils.js"; // Whitelist some imports that are known not to import forbidden modules const whitelistedImports = [ diff --git a/packages/eslint-plugin/src/rules/no-internal-cc-types.ts b/packages/eslint-plugin/src/rules/no-internal-cc-types.ts index f11840c74799..d951c119fe09 100644 --- a/packages/eslint-plugin/src/rules/no-internal-cc-types.ts +++ b/packages/eslint-plugin/src/rules/no-internal-cc-types.ts @@ -4,7 +4,7 @@ import { ESLintUtils, type TSESTree, } from "@typescript-eslint/utils"; -import { type Rule } from "../utils"; +import { type Rule } from "../utils.js"; // const isFixMode = process.argv.some((arg) => arg.startsWith("--fix")); diff --git a/packages/eslint-plugin/src/rules/no-misspelled-names.ts b/packages/eslint-plugin/src/rules/no-misspelled-names.ts index 8446e3f98861..d79b72dfacb0 100644 --- a/packages/eslint-plugin/src/rules/no-misspelled-names.ts +++ b/packages/eslint-plugin/src/rules/no-misspelled-names.ts @@ -1,5 +1,5 @@ import { type AST } from "jsonc-eslint-parser"; -import { type JSONCRule } from "../utils"; +import { type JSONCRule } from "../utils.js"; interface CommonError { pattern: string | RegExp; diff --git a/packages/eslint-plugin/src/rules/no-surrounding-whitespace.ts b/packages/eslint-plugin/src/rules/no-surrounding-whitespace.ts index 802212dd2455..99a1d156097b 100644 --- a/packages/eslint-plugin/src/rules/no-surrounding-whitespace.ts +++ b/packages/eslint-plugin/src/rules/no-surrounding-whitespace.ts @@ -1,5 +1,5 @@ import { type AST } from "jsonc-eslint-parser"; -import { type JSONCRule } from "../utils"; +import { type JSONCRule } from "../utils.js"; function isSurroundedByWhitespace(str: string) { return /^\s/.test(str) || /\s$/.test(str); diff --git a/packages/eslint-plugin/src/rules/no-unnecessary-min-max-value.ts b/packages/eslint-plugin/src/rules/no-unnecessary-min-max-value.ts index 4d373e54031d..85d3f86d1715 100644 --- a/packages/eslint-plugin/src/rules/no-unnecessary-min-max-value.ts +++ b/packages/eslint-plugin/src/rules/no-unnecessary-min-max-value.ts @@ -1,5 +1,5 @@ import type { AST } from "jsonc-eslint-parser"; -import { type JSONCRule, removeJSONProperty } from "../utils"; +import { type JSONCRule, removeJSONProperty } from "../utils.js"; export const noUnnecessaryMinMaxValue: JSONCRule.RuleModule = { create(context) { diff --git a/packages/eslint-plugin/src/rules/no-useless-description.ts b/packages/eslint-plugin/src/rules/no-useless-description.ts index 813dad5004bd..b39e6ab7c820 100644 --- a/packages/eslint-plugin/src/rules/no-useless-description.ts +++ b/packages/eslint-plugin/src/rules/no-useless-description.ts @@ -1,6 +1,6 @@ import { type AST } from "jsonc-eslint-parser"; -import { CONFIG_PARAM } from "../jsonSelectors"; -import { type JSONCRule, removeJSONProperty } from "../utils"; +import { CONFIG_PARAM } from "../jsonSelectors.js"; +import { type JSONCRule, removeJSONProperty } from "../utils.js"; export const noUselessDescription: JSONCRule.RuleModule = { create(context) { diff --git a/packages/eslint-plugin/src/rules/no-value-in-option-label.ts b/packages/eslint-plugin/src/rules/no-value-in-option-label.ts index 53f5732b2dbe..de199c9f8088 100644 --- a/packages/eslint-plugin/src/rules/no-value-in-option-label.ts +++ b/packages/eslint-plugin/src/rules/no-value-in-option-label.ts @@ -1,6 +1,6 @@ import { type AST } from "jsonc-eslint-parser"; -import { CONFIG_OPTION } from "../jsonSelectors"; -import { type JSONCRule, getJSONNumber } from "../utils"; +import { CONFIG_OPTION } from "../jsonSelectors.js"; +import { type JSONCRule, getJSONNumber } from "../utils.js"; const startsWithNumber = /^\d(?![\/-])/; // allow - and / as the next chars const isNumberWithUnit = /^\d+(\.\d+)?\s?[°\w%µ]+/; diff --git a/packages/eslint-plugin/src/rules/prefer-defaultvalue.ts b/packages/eslint-plugin/src/rules/prefer-defaultvalue.ts index 5cd29d6d35a8..fe8af3096708 100644 --- a/packages/eslint-plugin/src/rules/prefer-defaultvalue.ts +++ b/packages/eslint-plugin/src/rules/prefer-defaultvalue.ts @@ -1,5 +1,5 @@ import { type AST } from "jsonc-eslint-parser"; -import { type JSONCRule } from "../utils"; +import { type JSONCRule } from "../utils.js"; export const preferDefaultValue: JSONCRule.RuleModule = { create(context) { diff --git a/packages/eslint-plugin/src/utils/titleAndSentenceCase.ts b/packages/eslint-plugin/src/utils/titleAndSentenceCase.ts index de4029bd00f7..531a67987e17 100644 --- a/packages/eslint-plugin/src/utils/titleAndSentenceCase.ts +++ b/packages/eslint-plugin/src/utils/titleAndSentenceCase.ts @@ -5,7 +5,7 @@ import { isHyphenatedWord, joinWords, splitIntoWords, -} from "./wordsAndNames"; +} from "./wordsAndNames.js"; const titleCaseExceptions = [ "with", diff --git a/yarn.lock b/yarn.lock index 3ddaa7e035d1..839042747c6a 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1411,13 +1411,13 @@ __metadata: languageName: node linkType: hard -"@types/eslint@npm:^8.56.7": - version: 8.56.7 - resolution: "@types/eslint@npm:8.56.7" +"@types/eslint@npm:^8.56.10": + version: 8.56.10 + resolution: "@types/eslint@npm:8.56.10" dependencies: "@types/estree": "npm:*" "@types/json-schema": "npm:*" - checksum: 10/4c90f30a19bc5a01b27afc4f7e3efa28d191b7c9505fd4f6373d1dcdf8e93b939628d92ae730c3ef77bf2a094622296bb307cbecbad7cb6b43ef31dd722f6944 + checksum: 10/0cdd914b944ebba51c35827d3ef95bc3e16eb82b4c2741f6437fa57cdb00a4407c77f89c220afe9e4c9566982ec8a0fb9b97c956ac3bd4623a3b6af32eed8424 languageName: node linkType: hard @@ -1641,15 +1641,15 @@ __metadata: languageName: node linkType: hard -"@typescript-eslint/eslint-plugin@npm:^7.13.0": - version: 7.13.0 - resolution: "@typescript-eslint/eslint-plugin@npm:7.13.0" +"@typescript-eslint/eslint-plugin@npm:7.16.0": + version: 7.16.0 + resolution: "@typescript-eslint/eslint-plugin@npm:7.16.0" dependencies: "@eslint-community/regexpp": "npm:^4.10.0" - "@typescript-eslint/scope-manager": "npm:7.13.0" - "@typescript-eslint/type-utils": "npm:7.13.0" - "@typescript-eslint/utils": "npm:7.13.0" - "@typescript-eslint/visitor-keys": "npm:7.13.0" + "@typescript-eslint/scope-manager": "npm:7.16.0" + "@typescript-eslint/type-utils": "npm:7.16.0" + "@typescript-eslint/utils": "npm:7.16.0" + "@typescript-eslint/visitor-keys": "npm:7.16.0" graphemer: "npm:^1.4.0" ignore: "npm:^5.3.1" natural-compare: "npm:^1.4.0" @@ -1660,25 +1660,25 @@ __metadata: peerDependenciesMeta: typescript: optional: true - checksum: 10/93c3a0d8871d8351187503152a6c5199714eb62c96991e0d3e0caaee6881839dee4ad55e5de5d1a4389ae12ed10d3a845603de1f2f581337f782f19113022a65 + checksum: 10/beda6b586bfc953843877395b09acc0525d727dcb77e6ded5fbc645a9008b7e60360ddbaf6a9b7deaf23cd42c206412b7150d8df27f1fe2da3dc24dfab1c8d71 languageName: node linkType: hard -"@typescript-eslint/parser@npm:^7.13.0": - version: 7.13.0 - resolution: "@typescript-eslint/parser@npm:7.13.0" +"@typescript-eslint/parser@npm:7.16.0": + version: 7.16.0 + resolution: "@typescript-eslint/parser@npm:7.16.0" dependencies: - "@typescript-eslint/scope-manager": "npm:7.13.0" - "@typescript-eslint/types": "npm:7.13.0" - "@typescript-eslint/typescript-estree": "npm:7.13.0" - "@typescript-eslint/visitor-keys": "npm:7.13.0" + "@typescript-eslint/scope-manager": "npm:7.16.0" + "@typescript-eslint/types": "npm:7.16.0" + "@typescript-eslint/typescript-estree": "npm:7.16.0" + "@typescript-eslint/visitor-keys": "npm:7.16.0" debug: "npm:^4.3.4" peerDependencies: eslint: ^8.56.0 peerDependenciesMeta: typescript: optional: true - checksum: 10/ad930d9138c3caa9e0ac2d887798318b5b06df5aa1ecc50c2d8cd912e00cf13eb007256bfb4c11709f0191fc180614a15f84c0f0f03a50f035b0b8af0eb9409c + checksum: 10/dc374e6c9e7dfcdd968828bb32ef59d3ebabd0a18671dee22d14dda2c713dade6eb493fd11b127df17035c7451898b42f4a88102da9a4bf3ca6a3baed8c20309 languageName: node linkType: hard @@ -1702,12 +1702,22 @@ __metadata: languageName: node linkType: hard -"@typescript-eslint/type-utils@npm:7.13.0": - version: 7.13.0 - resolution: "@typescript-eslint/type-utils@npm:7.13.0" +"@typescript-eslint/scope-manager@npm:7.16.0": + version: 7.16.0 + resolution: "@typescript-eslint/scope-manager@npm:7.16.0" dependencies: - "@typescript-eslint/typescript-estree": "npm:7.13.0" - "@typescript-eslint/utils": "npm:7.13.0" + "@typescript-eslint/types": "npm:7.16.0" + "@typescript-eslint/visitor-keys": "npm:7.16.0" + checksum: 10/bf39a3ab803503c33e6c33568e7b93793d53d18100cb2f2ec1a540121aeba74d291d19c9ad3933198ff15e53a46d2f92db0c54309259dc99c1e3e297becd5677 + languageName: node + linkType: hard + +"@typescript-eslint/type-utils@npm:7.16.0": + version: 7.16.0 + resolution: "@typescript-eslint/type-utils@npm:7.16.0" + dependencies: + "@typescript-eslint/typescript-estree": "npm:7.16.0" + "@typescript-eslint/utils": "npm:7.16.0" debug: "npm:^4.3.4" ts-api-utils: "npm:^1.3.0" peerDependencies: @@ -1715,7 +1725,7 @@ __metadata: peerDependenciesMeta: typescript: optional: true - checksum: 10/f51ccb3c59963db82a504b02c8d15bc518137c176b8d39891f7bcb7b4b02ca0fa918a3754781f198f592f1047dc24c49086430bbef857d877d085e14d33f7a6c + checksum: 10/84925c851a515768317573984dc855ac93bf787ebaa6382379dea6b356adb936ebd38bf7ab2f95124c68de7ab1fd5c849fe6717929343a80b839757fb5bf3af0 languageName: node linkType: hard @@ -1733,6 +1743,13 @@ __metadata: languageName: node linkType: hard +"@typescript-eslint/types@npm:7.16.0": + version: 7.16.0 + resolution: "@typescript-eslint/types@npm:7.16.0" + checksum: 10/0813d9eb158f984b9d7e9e83961533ddc1e8c8815ca9059dab820df276b1e537b183f4c83cc4fe79ab3865cde1a64f2ec3f7fffe7209872d7d404636299f630b + languageName: node + linkType: hard + "@typescript-eslint/typescript-estree@npm:6.21.0": version: 6.21.0 resolution: "@typescript-eslint/typescript-estree@npm:6.21.0" @@ -1771,17 +1788,36 @@ __metadata: languageName: node linkType: hard -"@typescript-eslint/utils@npm:7.13.0, @typescript-eslint/utils@npm:^7.13.0": - version: 7.13.0 - resolution: "@typescript-eslint/utils@npm:7.13.0" +"@typescript-eslint/typescript-estree@npm:7.16.0": + version: 7.16.0 + resolution: "@typescript-eslint/typescript-estree@npm:7.16.0" + dependencies: + "@typescript-eslint/types": "npm:7.16.0" + "@typescript-eslint/visitor-keys": "npm:7.16.0" + debug: "npm:^4.3.4" + globby: "npm:^11.1.0" + is-glob: "npm:^4.0.3" + minimatch: "npm:^9.0.4" + semver: "npm:^7.6.0" + ts-api-utils: "npm:^1.3.0" + peerDependenciesMeta: + typescript: + optional: true + checksum: 10/5719c0cb649d627a073f1c8994a6073acc211ecfce0daef61d2de4315e42a23cf79e4dacb3b3596c4792eab062fdd22080c62345e2a58d38e7268eb6103a46d4 + languageName: node + linkType: hard + +"@typescript-eslint/utils@npm:7.16.0": + version: 7.16.0 + resolution: "@typescript-eslint/utils@npm:7.16.0" dependencies: "@eslint-community/eslint-utils": "npm:^4.4.0" - "@typescript-eslint/scope-manager": "npm:7.13.0" - "@typescript-eslint/types": "npm:7.13.0" - "@typescript-eslint/typescript-estree": "npm:7.13.0" + "@typescript-eslint/scope-manager": "npm:7.16.0" + "@typescript-eslint/types": "npm:7.16.0" + "@typescript-eslint/typescript-estree": "npm:7.16.0" peerDependencies: eslint: ^8.56.0 - checksum: 10/c87bbb90c958ed4617f88767890af2a797adcf28060e85809a9cad2ce4ed55b5db685d3a8d062dbbf89d2a49e85759e2a9deb92ee1946a95d5de6cbd14ea42f4 + checksum: 10/325eab6705e70322d8df613cba4b018abc5d8ef857eb6c86f7a8376334eac789e6a585d30c041045c7eeede18083744faae66f48033e7811b2a23ebe8f6d3407 languageName: node linkType: hard @@ -1802,6 +1838,20 @@ __metadata: languageName: node linkType: hard +"@typescript-eslint/utils@npm:^7.13.0": + version: 7.13.0 + resolution: "@typescript-eslint/utils@npm:7.13.0" + dependencies: + "@eslint-community/eslint-utils": "npm:^4.4.0" + "@typescript-eslint/scope-manager": "npm:7.13.0" + "@typescript-eslint/types": "npm:7.13.0" + "@typescript-eslint/typescript-estree": "npm:7.13.0" + peerDependencies: + eslint: ^8.56.0 + checksum: 10/c87bbb90c958ed4617f88767890af2a797adcf28060e85809a9cad2ce4ed55b5db685d3a8d062dbbf89d2a49e85759e2a9deb92ee1946a95d5de6cbd14ea42f4 + languageName: node + linkType: hard + "@typescript-eslint/visitor-keys@npm:6.21.0": version: 6.21.0 resolution: "@typescript-eslint/visitor-keys@npm:6.21.0" @@ -1822,6 +1872,16 @@ __metadata: languageName: node linkType: hard +"@typescript-eslint/visitor-keys@npm:7.16.0": + version: 7.16.0 + resolution: "@typescript-eslint/visitor-keys@npm:7.16.0" + dependencies: + "@typescript-eslint/types": "npm:7.16.0" + eslint-visitor-keys: "npm:^3.4.3" + checksum: 10/aae065bdd6d5681d40df51af24933fc86c15f355f9d8f85c39a506f352ddc2a76fc72d4f8cf823ebb7550c84d543605a2fdd7d06979a0967cd48c1f542436714 + languageName: node + linkType: hard + "@ungap/structured-clone@npm:^1.2.0": version: 1.2.0 resolution: "@ungap/structured-clone@npm:1.2.0" @@ -1969,7 +2029,7 @@ __metadata: version: 0.0.0-use.local resolution: "@zwave-js/eslint-plugin@workspace:packages/eslint-plugin" dependencies: - "@types/eslint": "npm:^8.56.7" + "@types/eslint": "npm:^8.56.10" "@typescript-eslint/utils": "npm:^7.13.0" "@zwave-js/core": "workspace:*" eslint: "npm:^8.57.0" @@ -2106,8 +2166,6 @@ __metadata: "@types/node": "npm:^18.19.31" "@types/semver": "npm:^7.5.8" "@types/source-map-support": "npm:^0.5.10" - "@typescript-eslint/eslint-plugin": "npm:^7.13.0" - "@typescript-eslint/parser": "npm:^7.13.0" "@zwave-js/cc": "workspace:*" "@zwave-js/config": "workspace:*" "@zwave-js/core": "workspace:*" @@ -2147,6 +2205,7 @@ __metadata: ts-patch: "npm:3.2.1" turbo: "npm:1.7.4" typescript: "npm:5.5.3" + typescript-eslint: "npm:^7.16.0" zwave-js: "workspace:*" languageName: unknown linkType: soft @@ -8897,6 +8956,22 @@ __metadata: languageName: node linkType: hard +"typescript-eslint@npm:^7.16.0": + version: 7.16.0 + resolution: "typescript-eslint@npm:7.16.0" + dependencies: + "@typescript-eslint/eslint-plugin": "npm:7.16.0" + "@typescript-eslint/parser": "npm:7.16.0" + "@typescript-eslint/utils": "npm:7.16.0" + peerDependencies: + eslint: ^8.56.0 + peerDependenciesMeta: + typescript: + optional: true + checksum: 10/36f979d1fb28ec9b902bb9d4f3c38d87bbd3220590940c8be4b7b5f3243f84c7d3d6806776ad4091c5705c883ce97811a9b75ea28502fa00a62eb1f88003ee01 + languageName: node + linkType: hard + "typescript@npm:5.4.2": version: 5.4.2 resolution: "typescript@npm:5.4.2"