diff --git a/eslint.config.mjs b/eslint.config.mjs index c577ce741..ff31ae631 100644 --- a/eslint.config.mjs +++ b/eslint.config.mjs @@ -1,23 +1,32 @@ -import path from 'path' -import { fileURLToPath } from 'url' -import { FlatCompat } from '@eslint/eslintrc' import pluginJs from '@eslint/js' +import pluginTs from '@typescript-eslint/eslint-plugin' +import parserTs from '@typescript-eslint/parser' +import eslintPluginYml from 'eslint-plugin-yml' +import parserYml from "yaml-eslint-parser" +import globals from 'globals' import licenseHeader from 'eslint-plugin-license-header' -// mimic CommonJS variables -- not needed if using CommonJS -const _filename = fileURLToPath(import.meta.url) -const _dirname = path.dirname(_filename) -const compat = new FlatCompat({ baseDirectory: _dirname, recommendedConfig: pluginJs.configs.recommended }) - export default [ pluginJs.configs.recommended, - ...compat.extends('standard-with-typescript'), { files: ['**/*.{js,ts}'], + languageOptions: { + parser: parserTs, + parserOptions: { + project: './tsconfig.json' + }, + globals: { + ...globals.jest, + ...globals.node, + }, + }, plugins: { + '@typescript-eslint': pluginTs, 'license-header': licenseHeader }, rules: { + ...pluginJs.configs.recommended.rules, + ...pluginTs.configs["recommended-type-checked"].rules, '@typescript-eslint/consistent-indexed-object-style': 'error', '@typescript-eslint/consistent-type-assertions': 'error', '@typescript-eslint/dot-notation': 'error', @@ -72,5 +81,19 @@ export default [ ] ] } + }, + ...eslintPluginYml.configs['flat/standard'], + { + files: ["**/*.yaml", "**/*.yml"], + languageOptions: { + parser: parserYml + }, + plugins: { + yml: eslintPluginYml + }, + rules: { + 'yml/no-empty-document': 'off', + 'yml/quotes': ['error', { prefer: 'single' }] + } } ] diff --git a/package-lock.json b/package-lock.json index 2456312fa..79bc21062 100644 --- a/package-lock.json +++ b/package-lock.json @@ -33,6 +33,7 @@ "eslint-plugin-license-header": "^0.6.1", "eslint-plugin-n": "^16.6.2", "eslint-plugin-promise": "^6.1.1", + "eslint-plugin-yml": "^1.14.0", "globals": "^15.0.0", "jest": "^29.7.0", "json-schema-to-typescript": "^14.0.4", @@ -3338,6 +3339,28 @@ "eslint": "^7.0.0 || ^8.0.0 || ^9.0.0" } }, + "node_modules/eslint-plugin-yml": { + "version": "1.14.0", + "resolved": "https://registry.npmjs.org/eslint-plugin-yml/-/eslint-plugin-yml-1.14.0.tgz", + "integrity": "sha512-ESUpgYPOcAYQO9czugcX5OqRvn/ydDVwGCPXY4YjPqc09rHaUVUA6IE6HLQys4rXk/S+qx3EwTd1wHCwam/OWQ==", + "dev": true, + "dependencies": { + "debug": "^4.3.2", + "eslint-compat-utils": "^0.5.0", + "lodash": "^4.17.21", + "natural-compare": "^1.4.0", + "yaml-eslint-parser": "^1.2.1" + }, + "engines": { + "node": "^14.17.0 || >=16.0.0" + }, + "funding": { + "url": "https://github.com/sponsors/ota-meshi" + }, + "peerDependencies": { + "eslint": ">=6.0.0" + } + }, "node_modules/eslint-scope": { "version": "7.2.2", "resolved": "https://registry.npmjs.org/eslint-scope/-/eslint-scope-7.2.2.tgz", @@ -7366,6 +7389,23 @@ "node": ">= 14" } }, + "node_modules/yaml-eslint-parser": { + "version": "1.2.3", + "resolved": "https://registry.npmjs.org/yaml-eslint-parser/-/yaml-eslint-parser-1.2.3.tgz", + "integrity": "sha512-4wZWvE398hCP7O8n3nXKu/vdq1HcH01ixYlCREaJL5NUMwQ0g3MaGFUBNSlmBtKmhbtVG/Cm6lyYmSVTEVil8A==", + "dev": true, + "dependencies": { + "eslint-visitor-keys": "^3.0.0", + "lodash": "^4.17.21", + "yaml": "^2.0.0" + }, + "engines": { + "node": "^14.17.0 || >=16.0.0" + }, + "funding": { + "url": "https://github.com/sponsors/ota-meshi" + } + }, "node_modules/yargs": { "version": "17.7.2", "resolved": "https://registry.npmjs.org/yargs/-/yargs-17.7.2.tgz", diff --git a/package.json b/package.json index 6e953726a..46fef107a 100644 --- a/package.json +++ b/package.json @@ -39,6 +39,7 @@ "eslint-plugin-license-header": "^0.6.1", "eslint-plugin-n": "^16.6.2", "eslint-plugin-promise": "^6.1.1", + "eslint-plugin-yml": "^1.14.0", "globals": "^15.0.0", "jest": "^29.7.0", "json-schema-to-typescript": "^14.0.4",