From 6f5f8fc0b9aa28169e40626ac652fad471c43c91 Mon Sep 17 00:00:00 2001 From: Max Hauser Date: Wed, 13 Nov 2024 13:45:10 +0100 Subject: [PATCH 1/2] allow 'require' imports for '.js' files (#16) --- README.md | 3 +++ eslint.config.mjs | 10 +++++++++- 2 files changed, 12 insertions(+), 1 deletion(-) 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: { From 9bdcbd31d044a7cd55dae5223bca09ea63f64d76 Mon Sep 17 00:00:00 2001 From: foxbot76 Date: Wed, 13 Nov 2024 13:46:05 +0100 Subject: [PATCH 2/2] [OFFICIAL RELEASE] 0.1.7 - (@foxriver76) Allow `require` imports for `.js` files --- README.md | 2 +- package-lock.json | 4 ++-- package.json | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index d75758c..1106c72 100644 --- a/README.md +++ b/README.md @@ -53,7 +53,7 @@ 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** +### 0.1.7 (2024-11-13) - (@foxriver76) Allow `require` imports for `.js` files ### 0.1.6 (2024-09-16) diff --git a/package-lock.json b/package-lock.json index 8995495..9727dc8 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "@iobroker/eslint-config", - "version": "0.1.6", + "version": "0.1.7", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "@iobroker/eslint-config", - "version": "0.1.6", + "version": "0.1.7", "devDependencies": { "@alcalzone/release-script": "^3.8.0" }, diff --git a/package.json b/package.json index 53d468f..6bdb1d5 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@iobroker/eslint-config", - "version": "0.1.6", + "version": "0.1.7", "description": "Eslint config of ioBroker", "homepage": "https://github.com/ioBroker/ioBroker.eslint-config", "main": "eslint.config.mjs",