From 796eef3af1291facc47b5273f83b0ef16d6d76b7 Mon Sep 17 00:00:00 2001 From: Bjorn Lu Date: Tue, 30 Jul 2024 04:14:34 +0800 Subject: [PATCH] chore: update eslint config (#17788) --- eslint.config.js | 11 ++++++++++- packages/vite/index.cjs | 3 --- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/eslint.config.js b/eslint.config.js index 0b103b517..b0126a964 100644 --- a/eslint.config.js +++ b/eslint.config.js @@ -133,7 +133,8 @@ export default tseslint.config( }, ], - 'regexp/no-contradiction-with-assertion': 'error', + 'regexp/prefer-regexp-exec': 'error', + 'regexp/prefer-regexp-test': 'error', // in some cases using explicit letter-casing is more performant than the `i` flag 'regexp/use-ignore-case': 'off', }, @@ -221,6 +222,14 @@ export default tseslint.config( 'n/no-extraneous-import': 'off', }, }, + { + name: 'disables/vite/cjs', + files: ['packages/vite/index.cjs'], + rules: { + 'no-restricted-globals': 'off', + 'n/no-missing-require': 'off', + }, + }, { name: 'disables/create-vite/templates', files: [ diff --git a/packages/vite/index.cjs b/packages/vite/index.cjs index ef2a18204..e51eefb6c 100644 --- a/packages/vite/index.cjs +++ b/packages/vite/index.cjs @@ -1,12 +1,9 @@ -/* eslint-disable no-restricted-globals */ - warnCjsUsage() // type utils module.exports.defineConfig = (config) => config // proxy cjs utils (sync functions) -// eslint-disable-next-line n/no-missing-require -- will be generated by build Object.assign(module.exports, require('./dist/node-cjs/publicUtils.cjs')) // async functions, can be redirect from ESM build