Skip to content

Commit f0cc8d0

Browse files
authored
Merge pull request #819 from ioBroker/copilot/add-check-for-obsolete-config-files
Add W5048: warn about obsolete eslint/prettier config files when using @iobroker/eslint-config
2 parents 479641b + d748ef1 commit f0cc8d0

2 files changed

Lines changed: 20 additions & 0 deletions

File tree

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ Example:
2626
### **WORK IN PROGRESS**
2727
-->
2828
### **WORK IN PROGRESS**
29+
- (@copilot) Added [W5048] check: warns about obsolete eslint/prettier config files (`.eslintignore`, `.eslintrc.json`, `.prettierignore`, `.prettierrc.js`, `.prettierrc.json`) when `@iobroker/eslint-config` is used as a devDependency.
2930
- (@copilot) Added [W4047]: warn when adapter is found in the latest repository but not yet available in the stable repository. Related to [#820].
3031
- (@copilot) Added `[E9506]`: error when an i18n directory is explicitly excluded by `.npmignore`, which would cause translations to be missing from the npm package.
3132
- (@copilot) Added `[E9507]`: error when an i18n directory is present in the repository but not covered by the `"files"` field in `package.json`, which would cause translations to be missing from the npm package.

lib/M5000_Code.js

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -899,6 +899,24 @@ async function checkCode(context) {
899899
}
900900
}
901901

902+
// W5048: Check for obsolete eslint/prettier config files when @iobroker/eslint-config is used
903+
if (context.packageJson.devDependencies && context.packageJson.devDependencies['@iobroker/eslint-config']) {
904+
const obsoleteFiles = [
905+
'/.eslintignore',
906+
'/.eslintrc.json',
907+
'/.prettierignore',
908+
'/.prettierrc.js',
909+
'/.prettierrc.json',
910+
];
911+
for (const file of obsoleteFiles) {
912+
if (context.filesList.includes(file)) {
913+
context.warnings.push(
914+
`[W5048] "${file.slice(1)}" is most likely obsolete when using "@iobroker/eslint-config". Please remove it.`,
915+
);
916+
}
917+
}
918+
}
919+
902920
if (context.packageJson.devDependencies && context.packageJson.devDependencies['@alcalzone/release-script']) {
903921
const version = context.packageJson.devDependencies['@alcalzone/release-script'];
904922
if (compareVersions.compareVersions(version, '3.0.0') >= 0) {
@@ -1450,6 +1468,7 @@ exports.checkCode = checkCode;
14501468
// [E5045] "/admin/jsonTab.json[5]" not found, but tab support is declared
14511469
// [W5046] "admin/jsonConfig.json" or "admin/jsonConfig.json5" found but "common.adminUI.config" is not set to "json" in io-package.json. Please add "common.adminUI": { "config": "json" }.
14521470
// [W5047] "${file}" is most likely outdated since jsonConfig is used. Please consider removing it.
1471+
// [W5048] "${file}" is most likely obsolete when using "@iobroker/eslint-config". Please remove it.
14531472
// [W5515] Schema validation skipped for "${configFile}" due to parse error: ${e.message}
14541473

14551474
// [5500 - ] see M5500_jsonConfig.js

0 commit comments

Comments
 (0)