From 218e4285283b8b252b461c3db853b4d4b9e2dcb5 Mon Sep 17 00:00:00 2001 From: Jens B Date: Sun, 22 Jun 2025 07:11:42 +0200 Subject: [PATCH 1/5] feat: enable `stylistic` rules `comma-dangele`, `indent`, `linebreak-style`, `no-trailing-spaces`, `object-curly-spacing`, `quotes`, `semi` --- eslint.config.mjs | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/eslint.config.mjs b/eslint.config.mjs index 040c2b7727..b0a176d9ce 100644 --- a/eslint.config.mjs +++ b/eslint.config.mjs @@ -14,7 +14,7 @@ const gitignore = fileURLToPath(new URL('.gitignore', import.meta.url)); const off = 0; const warn = 1; -// const error = 2; +const error = 2; const mitigatedJsRules = Object.fromEntries( Object.entries(js.configs.recommended.rules).map(([rule]) => [rule, warn]) @@ -68,13 +68,13 @@ const commonRules = { '@stylistic/arrow-parens': [warn, 'as-needed'], // https://eslint.style/rules/default/comma-dangle - '@stylistic/comma-dangle': [warn, 'never'], + '@stylistic/comma-dangle': [error, 'never'], // https://eslint.style/rules/js/indent#indent - '@stylistic/indent': [warn, 2, { SwitchCase: 1 }], + '@stylistic/indent': [error, 2, { SwitchCase: 1 }], // https://eslint.style/rules/js/linebreak-style#linebreak-style - '@stylistic/linebreak-style': [warn, 'unix'], + '@stylistic/linebreak-style': [error, 'unix'], // https://eslint.style/rules/js/max-len#max-len '@stylistic/max-len': [ @@ -89,16 +89,16 @@ const commonRules = { ], // https://eslint.style/rules/js/no-trailing-spaces#no-trailing-spaces - '@stylistic/no-trailing-spaces': warn, + '@stylistic/no-trailing-spaces': error, // https://eslint.style/rules/js/object-curly-spacing#object-curly-spacing - '@stylistic/object-curly-spacing': [warn, 'always'], + '@stylistic/object-curly-spacing': [error, 'always'], // https://eslint.style/rules/js/quotes#quotes - '@stylistic/quotes': [warn, 'single', { avoidEscape: true }], + '@stylistic/quotes': [error, 'single', { avoidEscape: true }], // https://eslint.style/rules/js/semi#semi - '@stylistic/semi': [warn, 'always'] + '@stylistic/semi': [error, 'always'] }; /** @type {import('eslint').Linter.RulesRecord} */ From b880d7a3241fb8e5f7928ba4dbfa6ba1f7b4efbd Mon Sep 17 00:00:00 2001 From: Jens B Date: Sun, 22 Jun 2025 07:38:05 +0200 Subject: [PATCH 2/5] fix: update @eslint/markdown to version 6.6.0 and enable 'markdown/no-duplicate-headings' rule --- eslint.config.mjs | 6 +++--- package-lock.json | 19 +++++++++++++++---- package.json | 2 +- 3 files changed, 19 insertions(+), 8 deletions(-) diff --git a/eslint.config.mjs b/eslint.config.mjs index b0a176d9ce..d04129fc8d 100644 --- a/eslint.config.mjs +++ b/eslint.config.mjs @@ -250,7 +250,7 @@ export default defineConfig([ 'markdown/fenced-code-language': off, 'markdown/heading-increment': off, 'markdown/no-duplicate-definitions': warn, - // 'markdown/no-duplicate-headings': ["error", { checkSiblingsOnly: true }], // @todo waiting for @eslint/markdown@6.6.0 + 'markdown/no-duplicate-headings': [warn, { checkSiblingsOnly: true }], 'markdown/no-empty-definitions': warn, 'markdown/no-empty-images': warn, 'markdown/no-empty-links': warn, @@ -263,7 +263,7 @@ export default defineConfig([ 'markdown/require-alt-text': warn, 'markdown/table-column-count': warn } - } + }, // https://github.com/eslint/markdown?tab=readme-ov-file#file-name-details // @todo // works out of the box but results in some `Parsing error`s @@ -271,5 +271,5 @@ export default defineConfig([ // * contributor_docs/fes_contribution_guide.md 354:1 error Parsing error: Unexpected character '🌸' // * contributor_docs/zh-Hans/unit_testing.md 35:1 error Parsing error: Unexpected token // * rfc_p5js_2.md 205:50 error Parsing error: Binding arguments in strict mode - // ...markdown.configs.processor + ...markdown.configs.processor ]); \ No newline at end of file diff --git a/package-lock.json b/package-lock.json index 6802ee68da..876e008e48 100644 --- a/package-lock.json +++ b/package-lock.json @@ -28,7 +28,7 @@ "devDependencies": { "@eslint/compat": "^1.2.9", "@eslint/js": "^9.28.0", - "@eslint/markdown": "^6.5.0", + "@eslint/markdown": "^6.6.0", "@rollup/plugin-alias": "^5.1.1", "@rollup/plugin-commonjs": "^25.0.7", "@rollup/plugin-json": "^6.1.0", @@ -916,14 +916,18 @@ } }, "node_modules/@eslint/markdown": { - "version": "6.5.0", - "resolved": "https://registry.npmjs.org/@eslint/markdown/-/markdown-6.5.0.tgz", - "integrity": "sha512-oSkF0p8X21vKEEAGTZASi7q3tbdTvlGduQ02Xz2A1AFncUP4RLVcNz27XurxVW4fs1JXuh0xBtvokXdtp/nN+Q==", + "version": "6.6.0", + "resolved": "https://registry.npmjs.org/@eslint/markdown/-/markdown-6.6.0.tgz", + "integrity": "sha512-IsWPy2jU3gaQDlioDC4sT4I4kG1hX1OMWs/q2sWwJrPoMASHW/Z4SDw+6Aql6EsHejGbagYuJbFq9Zvx+Y1b1Q==", "dev": true, "license": "MIT", + "workspaces": [ + "examples/*" + ], "dependencies": { "@eslint/core": "^0.14.0", "@eslint/plugin-kit": "^0.3.1", + "github-slugger": "^2.0.0", "mdast-util-from-markdown": "^2.0.2", "mdast-util-frontmatter": "^2.0.1", "mdast-util-gfm": "^3.0.0", @@ -964,6 +968,13 @@ "url": "https://github.com/sponsors/sindresorhus" } }, + "node_modules/@eslint/markdown/node_modules/github-slugger": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/github-slugger/-/github-slugger-2.0.0.tgz", + "integrity": "sha512-IaOQ9puYtjrkq7Y0Ygl9KDZnrf/aiUJYUpVf89y8kyaxbRG7Y1SrX/jaumrv81vc61+kiMempujsM3Yw7w5qcw==", + "dev": true, + "license": "ISC" + }, "node_modules/@eslint/markdown/node_modules/mdast-util-find-and-replace": { "version": "3.0.2", "resolved": "https://registry.npmjs.org/mdast-util-find-and-replace/-/mdast-util-find-and-replace-3.0.2.tgz", diff --git a/package.json b/package.json index 6ef20b8689..40049a8df1 100644 --- a/package.json +++ b/package.json @@ -39,7 +39,7 @@ "devDependencies": { "@eslint/compat": "^1.2.9", "@eslint/js": "^9.28.0", - "@eslint/markdown": "^6.5.0", + "@eslint/markdown": "^6.6.0", "@rollup/plugin-alias": "^5.1.1", "@rollup/plugin-commonjs": "^25.0.7", "@rollup/plugin-json": "^6.1.0", From 00c003274a2e0894b312fde50fe70d51316af85c Mon Sep 17 00:00:00 2001 From: Jens B Date: Sun, 22 Jun 2025 08:03:29 +0200 Subject: [PATCH 3/5] feat: enable `jsdoc` rules `jsdoc/check-alignment`, `jsdoc/no-multi-asterisks` `jsdoc/require-asterisk-prefix` --- eslint.config.mjs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/eslint.config.mjs b/eslint.config.mjs index d04129fc8d..2e08dd0f0a 100644 --- a/eslint.config.mjs +++ b/eslint.config.mjs @@ -104,17 +104,17 @@ const commonRules = { /** @type {import('eslint').Linter.RulesRecord} */ const jsdocRules = { // https://github.com/gajus/eslint-plugin-jsdoc/blob/99cb131ee40fa10f943aadfd73a6d18da082882f/docs/rules/check-alignment.md - 'jsdoc/check-alignment': warn, + 'jsdoc/check-alignment': error, // @todo // https://github.com/gajus/eslint-plugin-jsdoc/blob/99cb131ee40fa10f943aadfd73a6d18da082882f/docs/rules/check-line-alignment.md#readme // 'jsdoc/check-line-alignment': [warn, 'always'], // https://github.com/gajus/eslint-plugin-jsdoc/blob/99cb131ee40fa10f943aadfd73a6d18da082882f/docs/rules/no-multi-asterisks.md#readme - 'jsdoc/no-multi-asterisks': [warn, { allowWhitespace: true }], + 'jsdoc/no-multi-asterisks': [error, { allowWhitespace: true }], // https://github.com/gajus/eslint-plugin-jsdoc/blob/99cb131ee40fa10f943aadfd73a6d18da082882f/docs/rules/require-asterisk-prefix.md#readme - 'jsdoc/require-asterisk-prefix': warn + 'jsdoc/require-asterisk-prefix': error }; export default defineConfig([ From 0b1e3eaa4aa71ee26785fd0e0f5db02cc80124d6 Mon Sep 17 00:00:00 2001 From: Jens B Date: Sun, 22 Jun 2025 09:34:30 +0200 Subject: [PATCH 4/5] cleanup: move `md` rules to the top --- eslint.config.mjs | 39 ++++++++++++++++++++++----------------- 1 file changed, 22 insertions(+), 17 deletions(-) diff --git a/eslint.config.mjs b/eslint.config.mjs index 2e08dd0f0a..10756bfbb0 100644 --- a/eslint.config.mjs +++ b/eslint.config.mjs @@ -101,6 +101,7 @@ const commonRules = { '@stylistic/semi': [error, 'always'] }; +// https://github.com/gajus/eslint-plugin-jsdoc?tab=readme-ov-file#rules /** @type {import('eslint').Linter.RulesRecord} */ const jsdocRules = { // https://github.com/gajus/eslint-plugin-jsdoc/blob/99cb131ee40fa10f943aadfd73a6d18da082882f/docs/rules/check-alignment.md @@ -117,6 +118,26 @@ const jsdocRules = { 'jsdoc/require-asterisk-prefix': error }; +// https://github.com/eslint/markdown?tab=readme-ov-file#rules +/** @type {import('eslint').Linter.RulesRecord} */ +const markdownRules = { + 'markdown/fenced-code-language': off, + 'markdown/heading-increment': off, + 'markdown/no-duplicate-definitions': warn, + 'markdown/no-duplicate-headings': [warn, { checkSiblingsOnly: true }], + 'markdown/no-empty-definitions': warn, + 'markdown/no-empty-images': warn, + 'markdown/no-empty-links': warn, + 'markdown/no-html': off, + 'markdown/no-invalid-label-refs': off, + 'markdown/no-missing-atx-heading-space': warn, + 'markdown/no-missing-label-refs': off, // @todo + 'markdown/no-missing-link-fragments': off, + 'markdown/no-multiple-h1': off, + 'markdown/require-alt-text': warn, + 'markdown/table-column-count': warn +}; + export default defineConfig([ includeIgnoreFile(gitignore), globalIgnores([ @@ -246,23 +267,7 @@ export default defineConfig([ markdown }, language: 'markdown/commonmark', - rules: { - 'markdown/fenced-code-language': off, - 'markdown/heading-increment': off, - 'markdown/no-duplicate-definitions': warn, - 'markdown/no-duplicate-headings': [warn, { checkSiblingsOnly: true }], - 'markdown/no-empty-definitions': warn, - 'markdown/no-empty-images': warn, - 'markdown/no-empty-links': warn, - 'markdown/no-html': off, - 'markdown/no-invalid-label-refs': off, - 'markdown/no-missing-atx-heading-space': warn, - 'markdown/no-missing-label-refs': off, // @todo - 'markdown/no-missing-link-fragments': off, - 'markdown/no-multiple-h1': off, - 'markdown/require-alt-text': warn, - 'markdown/table-column-count': warn - } + rules: markdownRules }, // https://github.com/eslint/markdown?tab=readme-ov-file#file-name-details // @todo From 68ad514347b045a3229d27c84b0b6af378f0a205 Mon Sep 17 00:00:00 2001 From: Jens B Date: Sun, 22 Jun 2025 16:09:51 +0200 Subject: [PATCH 5/5] fix: set `recommended` to `error` --- eslint.config.mjs | 39 +++++++++++++++++---------------------- 1 file changed, 17 insertions(+), 22 deletions(-) diff --git a/eslint.config.mjs b/eslint.config.mjs index 10756bfbb0..46417b6a9e 100644 --- a/eslint.config.mjs +++ b/eslint.config.mjs @@ -16,18 +16,13 @@ const off = 0; const warn = 1; const error = 2; -const mitigatedJsRules = Object.fromEntries( - Object.entries(js.configs.recommended.rules).map(([rule]) => [rule, warn]) -); - /** @type {import('eslint').Linter.RulesRecord} */ const commonRules = { // https://github.com/eslint/eslint/blob/main/packages/js/src/configs/eslint-recommended.js - // ...js.configs.recommended.rules, - ...mitigatedJsRules, + ...js.configs.recommended.rules, // https://eslint.org/docs/latest/rules/eqeqeq - eqeqeq: [warn, 'smart'], + eqeqeq: [error, 'smart'], // https://eslint.org/docs/latest/rules/new-cap 'new-cap': off, @@ -36,16 +31,16 @@ const commonRules = { 'no-async-promise-executor': off, // https://eslint.org/docs/latest/rules/no-caller - 'no-caller': warn, + 'no-caller': error, // https://eslint.org/docs/latest/rules/no-cond-assign - 'no-cond-assign': [warn, 'except-parens'], + 'no-cond-assign': [error, 'except-parens'], // https://eslint.org/docs/latest/rules/no-console 'no-console': off, // https://eslint.org/docs/latest/rules/no-empty - 'no-empty': [warn, { allowEmptyCatch: true }], + 'no-empty': [error, { allowEmptyCatch: true }], // https://eslint.org/docs/latest/rules/no-prototype-builtins 'no-prototype-builtins': off, @@ -55,26 +50,26 @@ const commonRules = { // https://eslint.org/docs/latest/rules/no-unused-vars 'no-unused-vars': [ - warn, + error, { args: 'none' } ], // https://eslint.org/docs/latest/rules/no-use-before-define - 'no-use-before-define': [warn, { functions: false }], + 'no-use-before-define': [error, { functions: false }], // https://eslint.style/rules/js/arrow-parens#arrow-parens '@stylistic/arrow-parens': [warn, 'as-needed'], // https://eslint.style/rules/default/comma-dangle - '@stylistic/comma-dangle': [error, 'never'], + '@stylistic/comma-dangle': [warn, 'never'], // https://eslint.style/rules/js/indent#indent - '@stylistic/indent': [error, 2, { SwitchCase: 1 }], + '@stylistic/indent': [warn, 2, { SwitchCase: 1 }], // https://eslint.style/rules/js/linebreak-style#linebreak-style - '@stylistic/linebreak-style': [error, 'unix'], + '@stylistic/linebreak-style': [warn, 'unix'], // https://eslint.style/rules/js/max-len#max-len '@stylistic/max-len': [ @@ -89,33 +84,33 @@ const commonRules = { ], // https://eslint.style/rules/js/no-trailing-spaces#no-trailing-spaces - '@stylistic/no-trailing-spaces': error, + '@stylistic/no-trailing-spaces': warn, // https://eslint.style/rules/js/object-curly-spacing#object-curly-spacing - '@stylistic/object-curly-spacing': [error, 'always'], + '@stylistic/object-curly-spacing': [warn, 'always'], // https://eslint.style/rules/js/quotes#quotes - '@stylistic/quotes': [error, 'single', { avoidEscape: true }], + '@stylistic/quotes': [warn, 'single', { avoidEscape: true }], // https://eslint.style/rules/js/semi#semi - '@stylistic/semi': [error, 'always'] + '@stylistic/semi': [warn, 'always'] }; // https://github.com/gajus/eslint-plugin-jsdoc?tab=readme-ov-file#rules /** @type {import('eslint').Linter.RulesRecord} */ const jsdocRules = { // https://github.com/gajus/eslint-plugin-jsdoc/blob/99cb131ee40fa10f943aadfd73a6d18da082882f/docs/rules/check-alignment.md - 'jsdoc/check-alignment': error, + 'jsdoc/check-alignment': warn, // @todo // https://github.com/gajus/eslint-plugin-jsdoc/blob/99cb131ee40fa10f943aadfd73a6d18da082882f/docs/rules/check-line-alignment.md#readme // 'jsdoc/check-line-alignment': [warn, 'always'], // https://github.com/gajus/eslint-plugin-jsdoc/blob/99cb131ee40fa10f943aadfd73a6d18da082882f/docs/rules/no-multi-asterisks.md#readme - 'jsdoc/no-multi-asterisks': [error, { allowWhitespace: true }], + 'jsdoc/no-multi-asterisks': [warn, { allowWhitespace: true }], // https://github.com/gajus/eslint-plugin-jsdoc/blob/99cb131ee40fa10f943aadfd73a6d18da082882f/docs/rules/require-asterisk-prefix.md#readme - 'jsdoc/require-asterisk-prefix': error + 'jsdoc/require-asterisk-prefix': warn }; // https://github.com/eslint/markdown?tab=readme-ov-file#rules