diff --git a/README.md b/README.md index ad86e2a..d75758c 100644 --- a/README.md +++ b/README.md @@ -53,6 +53,9 @@ It is suggested to create separate `eslint.config.mjs` files for backend and for Placeholder for the next version (at the beginning of the line): ### **WORK IN PROGRESS** --> +### **WORK IN PROGRESS** +- (@foxriver76) Allow `require` imports for `.js` files + ### 0.1.6 (2024-09-16) - (@GermanBluefox) Enforce the use of template literals instead of string concatenation: "Hello, " + name + "!" => `Hello, ${name}!` diff --git a/eslint.config.mjs b/eslint.config.mjs index 581387d..b83e4bd 100644 --- a/eslint.config.mjs +++ b/eslint.config.mjs @@ -6,6 +6,7 @@ import eslintPluginPrettierRecommended from 'eslint-plugin-prettier/recommended' import globals from 'globals'; import reactPlugin from 'eslint-plugin-react'; import reactHooksPlugin from 'eslint-plugin-react-hooks'; + /** * Rules for all JSDOC plugin usages */ @@ -136,6 +137,10 @@ const tsRules = { '@typescript-eslint/consistent-type-exports': 'error', }; +/** Separate config for .js files which is applied internally */ +const plainJsConfig = tseslint.configs.disableTypeChecked +plainJsConfig.rules['@typescript-eslint/no-require-imports'] = 'off'; + /** @type {import("eslint").Linter.FlatConfig[]} */ export default tseslint.config( eslint.configs.recommended, @@ -163,7 +168,7 @@ export default tseslint.config( }, { files: ['**/*.js'], - ...tseslint.configs.disableTypeChecked, + ...plainJsConfig, }, ); @@ -177,6 +182,9 @@ export const esmConfig = [ }, ]; +/** + * Config for React projects + */ export const reactConfig = [ { plugins: {