diff --git a/package-lock.json b/package-lock.json index 63b176fe34..dda25f6dc9 100644 --- a/package-lock.json +++ b/package-lock.json @@ -93,6 +93,7 @@ "node-polyfill-webpack-plugin": "^3.0.0", "resolve-url-loader": "^5.0.0", "sanitize-filename": "^1.6.3", + "stylelint-use-logical": "^2.1.2", "ts-node": "^10.9.1", "typescript": "^5.0.4", "url-loader": "^4.1.1", @@ -26612,6 +26613,19 @@ "dev": true, "peer": true }, + "node_modules/stylelint-use-logical": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/stylelint-use-logical/-/stylelint-use-logical-2.1.2.tgz", + "integrity": "sha512-4ffvPNk/swH4KS3izExWuzQOuzLmi0gb0uOhvxWJ20vDA5W5xKCjcHHtLoAj1kKvTIX6eGIN5xGtaVin9PD0wg==", + "dev": true, + "license": "CC0-1.0", + "engines": { + "node": ">=14.0.0" + }, + "peerDependencies": { + "stylelint": ">= 11 < 17" + } + }, "node_modules/stylelint/node_modules/ansi-regex": { "version": "6.0.1", "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-6.0.1.tgz", diff --git a/package.json b/package.json index 1762354d40..30659780db 100644 --- a/package.json +++ b/package.json @@ -168,6 +168,7 @@ "node-polyfill-webpack-plugin": "^3.0.0", "resolve-url-loader": "^5.0.0", "sanitize-filename": "^1.6.3", + "stylelint-use-logical": "^2.1.2", "ts-node": "^10.9.1", "typescript": "^5.0.4", "url-loader": "^4.1.1", diff --git a/stylelint.config.js b/stylelint.config.js index e6cf713ef0..39c866502a 100644 --- a/stylelint.config.js +++ b/stylelint.config.js @@ -7,6 +7,7 @@ const stylelintConfig = require('@nextcloud/stylelint-config') module.exports = { extends: ['@nextcloud/stylelint-config'], + plugins: ['stylelint-use-logical'], rules: { // For CSS Modules // If there will be more rules for CSS Modules - consider extending stylelint-config-css-modules @@ -16,5 +17,27 @@ module.exports = { ignorePseudoClasses: [...stylelintConfig.rules['selector-pseudo-class-no-unknown'][1].ignorePseudoClasses, 'global'], }, ], + 'csstools/use-logical': [ + 'always', + { + severity: 'warning', + // Only lint LTR-RTL properties for now + except: [ + // Position properties + 'top', + 'bottom', + // Position properties with directional suffixes + /-top$/, + /-bottom$/, + // Size properties + 'width', + 'max-width', + 'min-width', + 'height', + 'max-height', + 'min-height', + ], + }, + ], }, }