diff --git a/package-lock.json b/package-lock.json index 9e86b949..c3dab0b5 100644 --- a/package-lock.json +++ b/package-lock.json @@ -21,6 +21,7 @@ "@babel/preset-env": "^7.22.14", "@babel/preset-react": "^7.22.5", "@babel/register": "^7.22.5", + "@stylistic/stylelint-config": "^1.0.1", "@svgr/webpack": "^8.1.0", "@testing-library/jest-dom": "^6.1.2", "@testing-library/react": "^14.0.0", @@ -3161,6 +3162,52 @@ "@sinonjs/commons": "^3.0.0" } }, + "node_modules/@stylistic/stylelint-config": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/@stylistic/stylelint-config/-/stylelint-config-1.0.1.tgz", + "integrity": "sha512-JgFP88HZEyo34k9RpWVdcQJtLPrMxYE58IO3qypXhmvE/NmZohj+xjDtQ8UfaarnYsLecnldw57/GHum07Ctdw==", + "dev": true, + "dependencies": { + "@stylistic/stylelint-plugin": "^2.0.0" + }, + "engines": { + "node": "^18.12 || >=20.9" + }, + "peerDependencies": { + "stylelint": "^16.0.2" + } + }, + "node_modules/@stylistic/stylelint-plugin": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/@stylistic/stylelint-plugin/-/stylelint-plugin-2.1.2.tgz", + "integrity": "sha512-JsSqu0Y3vsX+PBl+DwULxC0cIv9C1yIcq1MXkx7pBOGtTqU26a75I8MPYMiEYvrsXgsKLi65xVgy1iLVSZquJA==", + "dev": true, + "dependencies": { + "@csstools/css-parser-algorithms": "^2.6.1", + "@csstools/css-tokenizer": "^2.2.4", + "@csstools/media-query-list-parser": "^2.1.9", + "is-plain-object": "^5.0.0", + "postcss-selector-parser": "^6.0.16", + "postcss-value-parser": "^4.2.0", + "style-search": "^0.1.0", + "stylelint": "^16.4.0" + }, + "engines": { + "node": "^18.12 || >=20.9" + }, + "peerDependencies": { + "stylelint": "^16.0.2" + } + }, + "node_modules/@stylistic/stylelint-plugin/node_modules/is-plain-object": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/is-plain-object/-/is-plain-object-5.0.0.tgz", + "integrity": "sha512-VRSzKkbMm5jMDoKLbltAkFQ5Qr7VDiTFGXxYFXXowVj387GeGNOCsOH6Msy00SGZ3Fp84b1Naa1psqgcCIEP5Q==", + "dev": true, + "engines": { + "node": ">=0.10.0" + } + }, "node_modules/@svgr/babel-plugin-add-jsx-attribute": { "version": "8.0.0", "resolved": "https://registry.npmjs.org/@svgr/babel-plugin-add-jsx-attribute/-/babel-plugin-add-jsx-attribute-8.0.0.tgz", @@ -12891,6 +12938,12 @@ "url": "https://github.com/sponsors/sindresorhus" } }, + "node_modules/style-search": { + "version": "0.1.0", + "resolved": "https://registry.npmjs.org/style-search/-/style-search-0.1.0.tgz", + "integrity": "sha512-Dj1Okke1C3uKKwQcetra4jSuk0DqbzbYtXipzFlFMZtowbF1x7BKJwB9AayVMyFARvU8EDrZdcax4At/452cAg==", + "dev": true + }, "node_modules/stylelint": { "version": "16.7.0", "resolved": "https://registry.npmjs.org/stylelint/-/stylelint-16.7.0.tgz", diff --git a/package.json b/package.json index 23317928..0d456234 100644 --- a/package.json +++ b/package.json @@ -66,6 +66,7 @@ "@babel/preset-env": "^7.22.14", "@babel/preset-react": "^7.22.5", "@babel/register": "^7.22.5", + "@stylistic/stylelint-config": "^1.0.1", "@svgr/webpack": "^8.1.0", "@testing-library/jest-dom": "^6.1.2", "@testing-library/react": "^14.0.0", diff --git a/src/components/Grid/_settings.scss b/src/components/Grid/_settings.scss index 45c79ade..eeade23d 100644 --- a/src/components/Grid/_settings.scss +++ b/src/components/Grid/_settings.scss @@ -8,11 +8,11 @@ $grid-responsive-properties: [ align-items, justify-content, justify-items, -]; // stylelint-disable-line indentation -- Broken rule? +]; // stylelint-disable-line @stylistic/indentation -- Broken rule? $grid-span-responsive-properties: [ column-span, row-span, -]; // stylelint-disable-line indentation -- Broken rule? +]; // stylelint-disable-line @stylistic/indentation -- Broken rule? $initial-fallback-value: initial; diff --git a/stylelint.config.js b/stylelint.config.js index 44940186..a9acf4f2 100644 --- a/stylelint.config.js +++ b/stylelint.config.js @@ -4,8 +4,15 @@ module.exports = { '@visionappscz/stylelint-config/order', '@visionappscz/stylelint-config/scss', '@visionappscz/stylelint-config/cssModules', + '@stylistic/stylelint-config', ], rules: { + // Allow @else and @elseif to be on the same line as the closing brace of the @if block. + '@stylistic/block-closing-brace-newline-after': 'always-single-line', + + // Use 4 spaces for indentation. + '@stylistic/indentation': 4, + // Check that custom property name starts with `rui` prefix and follows either SUIT CSS convention // (for components theming) or kebab-case syntax (for global design tokens and local properties). // @@ -20,6 +27,7 @@ module.exports = { message: 'Expected custom property name to start with `rui-*` and follow either SUIT CSS or kebab-case syntax', }, ], + // Require camelCase pattern for class names as they are picked up by dot notation in JS. // Also allow kebab-case class names for global helper and utility classes. //