From 450e1c3dbdcd83a270059749a275139a051ff11f Mon Sep 17 00:00:00 2001 From: Max Reichmann Date: Thu, 1 Aug 2024 16:16:08 +0200 Subject: [PATCH] [INTERNAL] Add common ignore patterns --- eslint.common.config.js | 146 +++++++++++++++++++++------------------- eslint.config.js | 12 ++-- 2 files changed, 81 insertions(+), 77 deletions(-) diff --git a/eslint.common.config.js b/eslint.common.config.js index e3a6a7089..c2f691503 100644 --- a/eslint.common.config.js +++ b/eslint.common.config.js @@ -4,88 +4,96 @@ import globals from "globals"; import js from "@eslint/js"; import google from "eslint-config-google"; -export default [ - js.configs.recommended, google, { - name: "Common ESLint config used for all tooling repos", +export default [{ + ignores: [ // Common ignore patterns across all tooling repos + "**/coverage/", + "test/tmp/", + "test/expected/", + "test/fixtures/", + "**/docs/", + "**/jsdocs/", + ], +}, js.configs.recommended, google, ava.configs["flat/recommended"], { + name: "Common ESLint config used for all tooling repos", - plugins: { - jsdoc, - ava, - }, - - languageOptions: { - globals: { - ...globals.node, - }, + plugins: { + jsdoc, + ava, + }, - ecmaVersion: 2023, - sourceType: "module", + languageOptions: { + globals: { + ...globals.node, }, - settings: { - jsdoc: { - mode: "jsdoc", + ecmaVersion: 2023, + sourceType: "module", + }, - tagNamePreference: { - return: "returns", - augments: "extends", - }, + settings: { + jsdoc: { + mode: "jsdoc", + + tagNamePreference: { + return: "returns", + augments: "extends", }, }, + }, - rules: { - "indent": ["error", "tab"], - "linebreak-style": ["error", "unix"], + rules: { + "indent": ["error", "tab"], + "linebreak-style": ["error", "unix"], - "quotes": ["error", "double", { - allowTemplateLiterals: true, - }], + "quotes": ["error", "double", { + allowTemplateLiterals: true, + }], - "semi": ["error", "always"], - "no-negated-condition": "off", - "require-jsdoc": "off", - "no-mixed-requires": "off", + "semi": ["error", "always"], + "no-negated-condition": "off", + "require-jsdoc": "off", + "no-mixed-requires": "off", - "max-len": ["error", { - code: 120, - ignoreUrls: true, - ignoreRegExpLiterals: true, - }], + "max-len": ["error", { + code: 120, + ignoreUrls: true, + ignoreRegExpLiterals: true, + }], - "no-implicit-coercion": [2, { - allow: ["!!"], - }], + "no-implicit-coercion": [2, { + allow: ["!!"], + }], - "comma-dangle": "off", - "no-tabs": "off", - "no-console": 2, // Disallow console.log() - // The following rule must be disabled as of ESLint 9. - // It's removed and causes issues when present - // https://eslint.org/docs/latest/rules/valid-jsdoc - "valid-jsdoc": 0, - "jsdoc/check-examples": 0, - "jsdoc/check-param-names": 2, - "jsdoc/check-tag-names": 2, - "jsdoc/check-types": 2, - "jsdoc/no-undefined-types": 0, - "jsdoc/require-description": 0, - "jsdoc/require-description-complete-sentence": 0, - "jsdoc/require-example": 0, - "jsdoc/require-hyphen-before-param-description": 0, - "jsdoc/require-param": 2, - "jsdoc/require-param-description": 0, - "jsdoc/require-param-name": 2, - "jsdoc/require-param-type": 2, - "jsdoc/require-returns": 0, - "jsdoc/require-returns-description": 0, - "jsdoc/require-returns-type": 2, + "comma-dangle": "off", + "no-tabs": "off", + "no-console": 2, // Disallow console.log() + // The following rule must be disabled as of ESLint 9. + // It's removed and causes issues when present + // https://eslint.org/docs/latest/rules/valid-jsdoc + "valid-jsdoc": 0, + "jsdoc/check-examples": 0, + "jsdoc/check-param-names": 2, + "jsdoc/check-tag-names": 2, + "jsdoc/check-types": 2, + "jsdoc/no-undefined-types": 0, + "jsdoc/require-description": 0, + "jsdoc/require-description-complete-sentence": 0, + "jsdoc/require-example": 0, + "jsdoc/require-hyphen-before-param-description": 0, + "jsdoc/require-param": 2, + "jsdoc/require-param-description": 0, + "jsdoc/require-param-name": 2, + "jsdoc/require-param-type": 2, + "jsdoc/require-returns": 0, + "jsdoc/require-returns-description": 0, + "jsdoc/require-returns-type": 2, - "jsdoc/tag-lines": [2, "any", { - startLines: 1, - }], + "jsdoc/tag-lines": [2, "any", { + startLines: 1, + }], - "jsdoc/valid-types": 0, - "ava/assertion-arguments": 0, - }, - } + "jsdoc/valid-types": 0, + "ava/assertion-arguments": 0, + }, +} ]; diff --git a/eslint.config.js b/eslint.config.js index 4f4a83cca..54ef6082a 100644 --- a/eslint.config.js +++ b/eslint.config.js @@ -2,15 +2,11 @@ import eslintCommonConfig from "./eslint.common.config.js"; export default [ ...eslintCommonConfig, // Load common ESLint config - { // Override with project-specific ESLint config rules (always below common!) + { + // Add project-specific ESLint config rules here + // in order to override common config ignores: [ "lib/processors/jsdoc/lib", - "**/coverage/", - "test/tmp/", - "test/expected/", - "test/fixtures/", - "**/docs/", - "**/jsdocs/", - ], + ] } ];