Skip to content

Commit

Permalink
feat(stylelint-config): use stylelint 16, update stylelint-config-sta…
Browse files Browse the repository at this point in the history
…ndard-scssand

This also means that all stylistic rules are now removed

BREAKING CHANGE: remove node support < 18.12.0 and remove support for stylelint < 16.1.0
  • Loading branch information
ernscht committed Jan 8, 2024
1 parent da896c9 commit a183537
Show file tree
Hide file tree
Showing 4 changed files with 169 additions and 339 deletions.
17 changes: 0 additions & 17 deletions codequality/stylelint/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,11 @@ module.exports = {
rules: {
'plugin/stylelint-bem-namics': true,
'alpha-value-notation': ['number', { severity: 'warning' }],
'at-rule-name-case': 'lower',
'at-rule-no-unknown': null,
'at-rule-no-vendor-prefix': true,
'at-rule-empty-line-before': null,
'block-no-empty': null,
'color-function-notation': ['modern', { severity: 'warning' }],
'color-hex-case': ['lower', { severity: 'warning' }],
'color-named': 'never',
'color-no-invalid-hex': [true, { severity: 'warning' }],
'comment-word-disallowed-list': ['todo', { severity: 'warning' }],
Expand All @@ -31,29 +29,19 @@ module.exports = {
{ ignore: ['consecutive-duplicates-with-different-values'], severity: 'warning' },
],
'declaration-block-no-shorthand-property-overrides': true,
'declaration-block-semicolon-newline-after': ['always-multi-line', { severity: 'warning' }],
'declaration-block-trailing-semicolon': ['always', { severity: 'warning' }],
'declaration-colon-space-after': ['always-single-line', { severity: 'warning' }],
'declaration-no-important': true,
'declaration-empty-line-before': null,
'declaration-block-no-redundant-longhand-properties': true,
'function-linear-gradient-no-nonstandard-direction': [true, { severity: 'warning' }],
'function-name-case': 'lower',
indentation: ['tab', { severity: 'warning' }],
'keyframes-name-pattern': null,
'length-zero-no-unit': true,
'max-empty-lines': [1, { severity: 'warning' }],
'max-line-length': null,
'max-nesting-depth': [2, { severity: 'warning' }],
'media-feature-name-case': 'lower',
'no-descending-specificity': null,
'no-duplicate-selectors': [true, { severity: 'warning' }],
'no-empty-source': null,
'no-missing-end-of-source-newline': [true, { severity: 'warning' }],
'no-unknown-animations': [true, { severity: 'warning' }],
'number-leading-zero': 'always',
'number-max-precision': 4,
'property-case': 'lower',
'property-no-unknown': [true, { ignoreProperties: 'font-icon' }],
'property-no-vendor-prefix': [true, { severity: 'warning' }],
'rule-empty-line-before': null,
Expand Down Expand Up @@ -83,16 +71,11 @@ module.exports = {
'scss/selector-no-union-class-name': true,
'selector-class-pattern': null,
'selector-id-pattern': null,
'selector-list-comma-newline-after': 'always-multi-line',
'selector-max-id': 0,
'selector-not-notation': 'complex',
'selector-pseudo-class-case': 'lower',
'selector-pseudo-element-case': 'lower',
'selector-pseudo-element-colon-notation': 'double',
'selector-type-case': 'lower',
'shorthand-property-no-redundant-values': true,
'string-quotes': 'single',
'unit-case': 'lower',
'value-keyword-case': ['lower', { camelCaseSvgKeywords: true }],
'value-no-vendor-prefix': [true, { severity: 'warning' }],
},
Expand Down
66 changes: 33 additions & 33 deletions codequality/stylelint/package.json
Original file line number Diff line number Diff line change
@@ -1,38 +1,38 @@
{
"name": "@merkle-open/stylelint-config",
"description": "Shared stylelint config",
"version": "3.2.0",
"repository": "https://github.com/merkle-open/frontend-defaults",
"main": "./index.js",
"license": "MIT",
"author": "Merkle Inc.",
"private": false,
"engines": {
"node": ">=14"
},
"files": [
"README.md",
"LICENSE",
"index.js"
],
"peerDependencies": {
"stylelint": "^15.5.0"
},
"devDependencies": {
"jest": "29.7.0",
"name": "@merkle-open/stylelint-config",
"description": "Shared stylelint config",
"version": "3.2.0",
"repository": "https://github.com/merkle-open/frontend-defaults",
"main": "./index.js",
"license": "MIT",
"author": "Merkle Inc.",
"private": false,
"engines": {
"node": ">=18.12.0"
},
"files": [
"README.md",
"LICENSE",
"index.js"
],
"peerDependencies": {
"stylelint": ">=16.1.0"
},
"devDependencies": {
"jest": "29.7.0",
"jest-light-runner": "0.6.0",
"stylelint": "15.11.0"
},
"dependencies": {
"@namics/stylelint-bem": "9.0.0",
"stylelint-config-standard-scss": "11.0.0"
},
"scripts": {
"lint:css": "stylelint tests/**/*.*ss --allow-empty-input",
"prepublishOnly": "npm test",
"test": "jest",
"watch-test": "jest --watchAll"
},
"stylelint": "16.1.0"
},
"dependencies": {
"@namics/stylelint-bem": "10.0.0",
"stylelint-config-standard-scss": "13.0.0"
},
"scripts": {
"lint:css": "stylelint tests/**/*.*ss --allow-empty-input",
"prepublishOnly": "npm test",
"test": "jest",
"watch-test": "jest --watchAll"
},
"jest": {
"runner": "jest-light-runner"
}
Expand Down
12 changes: 3 additions & 9 deletions codequality/stylelint/tests/invalid.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,20 +17,17 @@ describe('flags errors with invalid css', () => {
});

it('flags warnings', () => {
expect(result.results[0].warnings).toHaveLength(9);
expect(result.results[0].warnings).toHaveLength(6);
});

it('correct warning text', () => {
expect(result.results[0].warnings.map((w) => w.text)).toEqual([
'Expected class name "selector" to start with a valid prefix: "a-", "m-", "o-", "l-", "g-", "h-", "state-". (plugin/stylelint-bem-namics)',
'Expected class name "z-selector" to start with a valid prefix: "a-", "m-", "o-", "l-", "g-", "h-", "state-". (plugin/stylelint-bem-namics)',
'Expected modern color-function notation (color-function-notation)',
'Expected "#CCC" to be "#ccc" (color-hex-case)',
'Unexpected named color "darkgray" (color-named)',
'Unexpected !important (declaration-no-important)',
'Expected a leading zero (number-leading-zero)',
'Expected "#FOO" to have no more than 0 ID selectors (selector-max-id)',
'Expected single quotes (string-quotes)',
]);
});

Expand All @@ -39,12 +36,9 @@ describe('flags errors with invalid css', () => {
'plugin/stylelint-bem-namics',
'plugin/stylelint-bem-namics',
'color-function-notation',
'color-hex-case',
'color-named',
'declaration-no-important',
'number-leading-zero',
'selector-max-id',
'string-quotes',
]);
});

Expand All @@ -58,13 +52,13 @@ describe('flags errors with invalid css', () => {
expect(result.results[0].warnings[0].line).toBe(12);
expect(result.results[0].warnings[1].line).toBe(14);
expect(result.results[0].warnings[2].line).toBe(7);
expect(result.results[0].warnings[3].line).toBe(5);
expect(result.results[0].warnings[3].line).toBe(4);
});

it('correct column number', () => {
expect(result.results[0].warnings[0].column).toBe(1);
expect(result.results[0].warnings[1].column).toBe(1);
expect(result.results[0].warnings[2].column).toBe(22);
expect(result.results[0].warnings[3].column).toBe(20);
expect(result.results[0].warnings[3].column).toBe(9);
});
});

0 comments on commit a183537

Please sign in to comment.