Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove deprecated rules, but test for future ones #52

Merged
merged 1 commit into from
Feb 1, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 14 additions & 20 deletions __tests__/index.test.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,19 @@ describe('rules', () => {
it('is not empty', () => {
assert.ok(ruleNames.length > 0);
});
})

ruleNames.forEach((ruleName) => {
it(`${ruleName}`, async () => {
const rule = await stylelint.rules[ruleName];

// rules like `stylelint-order` don't have the same method signature and
// so we can't tell if they're deprectated or not
if (typeof rule !== 'undefined') {
assert.ok(!rule.meta.deprecated, `the ${ruleName} rule is deprecated`);
}
});
});
});

describe('with the valid example', () => {
const validScss = fs.readFileSync('./__tests__/valid.scss', 'utf-8');
Expand Down Expand Up @@ -50,7 +62,7 @@ describe('with the invalid example', () => {
});

it('has the correct amount of warnings', () => {
assert.equal(result.results[0].warnings.length, 46);
assert.equal(result.results[0].warnings.length, 28);
});

it('flags the correct rules', () => {
Expand All @@ -67,42 +79,24 @@ describe('with the invalid example', () => {
'scss/map-keys-quotes',
'scss/no-duplicate-dollar-variables',
'scss/dollar-variable-empty-line-before',
'block-closing-brace-empty-line-before',
'block-no-empty',
'block-opening-brace-space-before',
'color-hex-case',
'color-hex-case',
'color-hex-length',
'color-named',
'color-named',
'comment-whitespace-inside',
'comment-whitespace-inside',
'declaration-block-no-redundant-longhand-properties',
'declaration-block-semicolon-newline-before',
'declaration-block-semicolon-space-before',
'declaration-block-trailing-semicolon',
'declaration-block-trailing-semicolon',
'declaration-empty-line-before',
'declaration-empty-line-before',
'declaration-no-important',
'declaration-property-unit-allowed-list',
'declaration-property-value-disallowed-list',
'max-empty-lines',
'max-empty-lines',
'max-nesting-depth',
'no-empty-first-line',
'property-no-unknown',
'property-no-vendor-prefix',
'selector-list-comma-newline-after',
'selector-list-comma-space-before',
'selector-max-id',
'selector-max-id',
'selector-pseudo-element-case',
'selector-pseudo-element-colon-notation',
'unit-case',
'indentation',
'indentation',
'indentation',
],
);
});
Expand Down
38 changes: 1 addition & 37 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,52 +6,23 @@ module.exports = {
],
"rules": {
"at-rule-no-unknown": null,
"block-closing-brace-empty-line-before": "never",
"block-closing-brace-newline-before": "always-multi-line",
"block-opening-brace-newline-after": "always-multi-line",
"block-opening-brace-space-before": "always",
"color-hex-case": "lower",
"color-hex-length": "long",
"color-named": "never",
"comment-whitespace-inside": "always",
"declaration-bang-space-after": "never",
"declaration-bang-space-before": "always",
"declaration-block-no-redundant-longhand-properties": true,
"declaration-block-semicolon-newline-after": "always",
"declaration-block-semicolon-newline-before": "never-multi-line",
"declaration-block-semicolon-space-before": "never",
"declaration-block-trailing-semicolon": "always",
"declaration-colon-space-after": "always-single-line",
"declaration-colon-space-before": "never",
"declaration-no-important": true,
"declaration-property-unit-allowed-list": {
"line-height": []
},
"declaration-property-value-disallowed-list": {
"/^transition/": ["/all/"]
},
"function-comma-space-after": "always-single-line",
"function-comma-space-before": "never",
"function-parentheses-space-inside": "never-single-line",
"function-url-quotes": "always",
"indentation": 2,
"length-zero-no-unit": true,
"max-empty-lines": 1,
"max-line-length": 80,
"max-nesting-depth": 3,
"media-query-list-comma-newline-after": "always-multi-line",
"media-query-list-comma-newline-before": "never-multi-line",
"media-query-list-comma-space-after": "always",
"media-query-list-comma-space-before": "never",
"no-empty-first-line": true,
"no-empty-source": true,
"no-eol-whitespace": true,
"no-missing-end-of-source-newline": true,
"number-leading-zero": "always",
"number-no-trailing-zeros": true,
"order/properties-alphabetical-order": true,
"plugin/declaration-block-no-ignored-properties": true,
"property-case": "lower",
"property-no-unknown": [
true,
{
Expand All @@ -75,7 +46,7 @@ module.exports = {
"scss/at-else-if-parentheses-space-before": "never",
"scss/at-extend-no-missing-placeholder": true,
"scss/at-function-parentheses-space-before": "never",
"scss/at-import-no-partial-leading-underscore": true,
"scss/load-no-partial-leading-underscore": true,
"scss/at-import-partial-extension-blacklist": ["scss"],
"scss/at-mixin-parentheses-space-before": "never",
"scss/at-rule-no-unknown": true,
Expand All @@ -86,19 +57,12 @@ module.exports = {
"scss/operator-no-unspaced": true,
"scss/selector-no-redundant-nesting-selector": true,
"scss/selector-no-union-class-name": true,
"selector-list-comma-newline-after": "always",
"selector-list-comma-newline-before": "never-multi-line",
"selector-list-comma-space-before": "never",
"selector-max-id": 0,
"selector-no-qualifying-type": true,
"selector-no-vendor-prefix": true,
"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": "double",
"unit-case": "lower",
"value-keyword-case": "lower",
"value-no-vendor-prefix": true
}
Expand Down
Loading