Skip to content

Commit abbe580

Browse files
authored
Merge pull request #185 from nextcloud-libraries/fix/relax-defaults
fix: Relax recommended config to work also with libraries
2 parents 957d471 + 2185b62 commit abbe580

2 files changed

Lines changed: 8 additions & 4 deletions

File tree

lib/configs/recommended.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ module.exports = {
88
'@nextcloud',
99
],
1010
rules: {
11-
'@nextcloud/no-deprecations': ['warn', { parseAppInfo: true }],
12-
'@nextcloud/no-removed-apis': ['error', { parseAppInfo: true }],
11+
'@nextcloud/no-deprecations': ['warn'],
12+
'@nextcloud/no-removed-apis': ['error'],
1313
},
1414
};

lib/utils/version-parser.js

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ function createVersionValidator({ cwd, physicalFilename, options }) {
7171
}
7272

7373
// Try to find appinfo and parse the supported version
74-
if (settings?.parseAppInfo) {
74+
if (settings?.parseAppInfo !== false) {
7575
// Current working directory, either the filename (can be empty) or the cwd property
7676
const currentDirectory = path.isAbsolute(physicalFilename)
7777
? path.resolve(path.dirname(physicalFilename))
@@ -92,7 +92,11 @@ function createVersionValidator({ cwd, physicalFilename, options }) {
9292
maxVersion = sanitizeTargetVersion(maxVersion)
9393
return (version) => semver.lte(version, maxVersion)
9494
}
95-
throw Error('[@nextcloud/eslint-plugin] AppInfo parsing was enabled, but no `appinfo/info.xml` was found.')
95+
96+
if (settings?.parseAppInfo === true) {
97+
// User enforced app info parsing, so we throw an error - otherwise just fallback to default
98+
throw Error('[@nextcloud/eslint-plugin] AppInfo parsing was enabled, but no `appinfo/info.xml` was found.')
99+
}
96100
}
97101

98102
// If not configured or parsing is disabled, every rule should be handled

0 commit comments

Comments
 (0)