From aa6d04f4494f0417337dba785e195e76ea40c1b2 Mon Sep 17 00:00:00 2001 From: Kirk Swenson Date: Mon, 9 Dec 2024 10:30:22 -0800 Subject: [PATCH] chore: self code review tweaks --- v3/eslint.config.mjs | 8 ++++---- v3/package.json | 4 ++-- v3/tsconfig.json | 5 +++-- v3/webpack.config.js | 2 ++ 4 files changed, 11 insertions(+), 8 deletions(-) diff --git a/v3/eslint.config.mjs b/v3/eslint.config.mjs index 69a3ce0369..733dec4d32 100644 --- a/v3/eslint.config.mjs +++ b/v3/eslint.config.mjs @@ -15,13 +15,13 @@ import globals from "globals" import path from "node:path" import { fileURLToPath } from "node:url" -const __filename = fileURLToPath(import.meta.url); -const __dirname = path.dirname(__filename); +const __filename = fileURLToPath(import.meta.url) +const __dirname = path.dirname(__filename) const compat = new FlatCompat({ baseDirectory: __dirname, recommendedConfig: js.configs.recommended, allConfig: js.configs.all -}); +}) export default [{ ignores: ["**/dist/", "**/node_modules/", "src/models/formula/lezer"], @@ -78,7 +78,7 @@ export default [{ "@stylistic/block-spacing": ["off"], "@stylistic/comma-spacing": ["warn"], "@stylistic/eol-last": ["warn"], - "@stylistic/func-call-spacing": ["warn"], + "@stylistic/function-call-spacing": ["warn"], "@stylistic/keyword-spacing": ["warn"], "@stylistic/max-len": ["warn", { code: 120, ignoreUrls: true }], "@stylistic/no-tabs": "error", diff --git a/v3/package.json b/v3/package.json index 9872a50b68..6c5e16a005 100644 --- a/v3/package.json +++ b/v3/package.json @@ -62,8 +62,8 @@ "build:webpack": "webpack --mode production", "clean:cache": "rimraf .cache", "lezer:generate": "lezer-generator src/models/formula/lezer/formula.grammar -o src/models/formula/lezer/parser.js", - "lint": "eslint --cache --cache-location \".cache/eslint/default\" \"./src/**/*.{js,jsx,ts,tsx}\" \"./cypress/**/*.{js,jsx,ts,tsx}\"", - "lint:build": "eslint --cache --cache-strategy content --cache-location \".cache/eslint/build\" -c \"eslint.build.config.mjs\" \"./src/**/*.{js,jsx,ts,tsx}\" \"./cypress/**/*.{js,jsx,ts,tsx}\"", + "lint": "eslint --cache --cache-strategy content --cache-location \".cache/eslint/default\" -c \"eslint.config.mjs\" \"./src/**/*.{js,jsx,mjs,ts,tsx}\" \"./cypress/**/*.{js,jsx,ts,tsx}\"", + "lint:build": "eslint --cache --cache-strategy content --cache-location \".cache/eslint/build\" -c \"eslint.build.config.mjs\" \"./src/**/*.{js,jsx,mjs,ts,tsx}\" \"./cypress/**/*.{js,jsx,mjs,ts,tsx}\"", "lint:fix": "eslint --cache --fix \"./src/**/*.{js,jsx,ts,tsx}\" \"./cypress/**/*.{js,jsx,ts,tsx}\"", "lint:style": "eslint -c \".eslintrc.style.cjs\" \"./src/**/*.{js,jsx,ts,tsx}\" \"./cypress/**/*.{js,jsx,ts,tsx}\"", "lint:style:fix": "eslint -c \".eslintrc.style.cjs\" \"./src/**/*.{js,jsx,ts,tsx}\" \"./cypress/**/*.{js,jsx,ts,tsx}\"", diff --git a/v3/tsconfig.json b/v3/tsconfig.json index 5f0317fc44..99373d0d74 100644 --- a/v3/tsconfig.json +++ b/v3/tsconfig.json @@ -22,7 +22,7 @@ }, "include": [ "src/**/*", - ".eslintrc*.cjs", + "eslint.*.mjs", // cypress.config.ts will need another pass before being added // "*.config.ts", "*.config.js", @@ -30,6 +30,7 @@ ], "exclude": [ "src/**/*.v2.ts", - "*.grammar" + "*.grammar", + "*.json" ] } diff --git a/v3/webpack.config.js b/v3/webpack.config.js index 3fb2483c1b..c333147033 100644 --- a/v3/webpack.config.js +++ b/v3/webpack.config.js @@ -43,7 +43,9 @@ module.exports = (env, argv) => { // so we don't need to run it again as part of the webpack build webpackPlugins.push(new ESLintPlugin({ cacheLocation: path.resolve(__dirname, `${CACHE_DIRECTORY}/eslint-webpack-plugin/.eslintcache`), + configType: 'flat', extensions: ['ts', 'tsx', 'js', 'jsx'], + lintDirtyModulesOnly: true })) } if (!process.env.CODE_COVERAGE) {