Skip to content

Commit

Permalink
Remove 76 rules deprecated in 15.0.0 (#6979)
Browse files Browse the repository at this point in the history
I'll quickly explain the methodology for this PR:

1. remove each `lib/rules/*` for each deprecated test
2. remove each (now invalid) path from `lib/rules/index.js`
3. fix all broken tests, which fall into one of several categories:
    - tests that use a deprecated rule as an arbitrary rule; to resolve this, I just picked a different rule (usually `color-named` for `color-hex-case` and `number-max-precision` for `indentation`)
        - one of these is about a custom plugin, so I've rewritten the plugin
    - tests that are *about* deprecated rules; I added a `.skip` (have left comments in the review)
    - fs tests that use deprecated rules; I removed these from the config, then updated the snapshot.
      - the zen garden one doesn't work "out of the box" anymore, i.e. the snapshot has nontrivially changed because of indentation/spacing rules
    - `indentation`-specific behaviour (it being last); I deleted these!
4. remove all documentation related to removed rules (mostly `indentation`)
5. remove all unused utilities (via code coverage, not manual inspection)
  • Loading branch information
mattxwang authored and ybiquitous committed Oct 19, 2023
1 parent 958bf36 commit 7dc40ed
Show file tree
Hide file tree
Showing 291 changed files with 521 additions and 60,082 deletions.
5 changes: 5 additions & 0 deletions .changeset/rare-squids-tell.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"stylelint": major
---

Removed: 76 rules deprecated in 15.0.0
83 changes: 80 additions & 3 deletions docs/migration-guide/to-15.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,84 @@ Two significant changes may affect you:

### Deprecated stylistic rules

We've deprecated [76 of the rules that enforce stylistic conventions](../user-guide/rules.md#deprecated), e.g. `indentation`.
We've deprecated 76 of the rules that enforce stylistic conventions:

- `at-rule-name-case`
- `at-rule-name-newline-after`
- `at-rule-name-space-after`
- `at-rule-semicolon-newline-after`
- `at-rule-semicolon-space-before`
- `block-closing-brace-empty-line-before`
- `block-closing-brace-newline-after`
- `block-closing-brace-newline-before`
- `block-closing-brace-space-after`
- `block-closing-brace-space-before`
- `block-opening-brace-newline-after`
- `block-opening-brace-newline-before`
- `block-opening-brace-space-after`
- `block-opening-brace-space-before`
- `color-hex-case`
- `declaration-bang-space-after`
- `declaration-bang-space-before`
- `declaration-block-semicolon-newline-after`
- `declaration-block-semicolon-newline-before`
- `declaration-block-semicolon-space-after`
- `declaration-block-semicolon-space-before`
- `declaration-block-trailing-semicolon`
- `declaration-colon-newline-after`
- `declaration-colon-space-after`
- `declaration-colon-space-before`
- `function-comma-newline-after`
- `function-comma-newline-before`
- `function-comma-space-after`
- `function-comma-space-before`
- `function-max-empty-lines`
- `function-parentheses-newline-inside`
- `function-parentheses-space-inside`
- `function-whitespace-after`
- `indentation`
- `linebreaks`
- `max-empty-lines`
- `max-line-length`
- `media-feature-colon-space-after`
- `media-feature-colon-space-before`
- `media-feature-name-case`
- `media-feature-parentheses-space-inside`
- `media-feature-range-operator-space-after`
- `media-feature-range-operator-space-before`
- `media-query-list-comma-newline-after`
- `media-query-list-comma-newline-before`
- `media-query-list-comma-space-after`
- `media-query-list-comma-space-before`
- `no-empty-first-line`
- `no-eol-whitespace`
- `no-extra-semicolons`
- `no-missing-end-of-source-newline`
- `number-leading-zero`
- `number-no-trailing-zeros`
- `property-case`
- `selector-attribute-brackets-space-inside`
- `selector-attribute-operator-space-after`
- `selector-attribute-operator-space-before`
- `selector-combinator-space-after`
- `selector-combinator-space-before`
- `selector-descendant-combinator-no-non-space`
- `selector-list-comma-newline-after`
- `selector-list-comma-newline-before`
- `selector-list-comma-space-after`
- `selector-list-comma-space-before`
- `selector-max-empty-lines`
- `selector-pseudo-class-case`
- `selector-pseudo-class-parentheses-space-inside`
- `selector-pseudo-element-case`
- `string-quotes`
- `unicode-bom`
- `unit-case`
- `value-list-comma-newline-after`
- `value-list-comma-newline-before`
- `value-list-comma-space-after`
- `value-list-comma-space-before`
- `value-list-max-empty-lines`

When we created these rules, pretty printers (like [Prettier](https://prettier.io/)) didn't exist. They now offer a better way to consistently format code, especially whitespace. Linters and pretty printers are complementary tools that work together to help you write consistent and error-free code.

Expand All @@ -20,7 +97,7 @@ By deprecating these rules, we can:
- focus on writing and maintaining rules that help you [avoid errors](../user-guide/rules.md#avoid-errors) and [enforce (non-stylistic) conventions](../user-guide/rules.md#enforce-conventions), both of which are unique to Stylelint
- modernize our codebase, e.g. move to ESM so that we can update our dependencies and keep Stylelint secure for you

The [deprecated rules](../user-guide/rules.md#deprecated) will still work in this release (with a deprecation warning). In preparation for the next major release, when we'll remove the rules from Stylelint, we suggest:
The deprecated rules will still work in this release (with a deprecation warning). In preparation for the next major release, when we'll remove the rules from Stylelint, we suggest:

- extending the [standard config](https://www.npmjs.com/package/stylelint-config-standard) in your configuration object, if you don't already
- removing the deprecated rules from your configuration object
Expand All @@ -43,7 +120,7 @@ Additionally, you may no longer need to extend [Prettier's Stylelint config](htt
}
```

We've removed the [deprecated rules](../user-guide/rules.md#deprecated) from the latest version of the [standard config](https://www.npmjs.com/package/stylelint-config-standard). It still helps you write consistent CSS by turning on many of the [other rules that enforce conventions](../user-guide/rules.md#enforce-conventions), e.g. most of the [`*-notation`](../user-guide/rules.md#notation), [`*-pattern`](../user-guide/rules.md#pattern) and [`*-quotes`](../user-guide/rules.md#quotes) rules.
We've removed the deprecated rules from the latest version of the [standard config](https://www.npmjs.com/package/stylelint-config-standard). It still helps you write consistent CSS by turning on many of the [other rules that enforce conventions](../user-guide/rules.md#enforce-conventions), e.g. most of the [`*-notation`](../user-guide/rules.md#notation), [`*-pattern`](../user-guide/rules.md#pattern) and [`*-quotes`](../user-guide/rules.md#quotes) rules.

There are lots of other rules we don't turn on in the [standard config](https://www.npmjs.com/package/stylelint-config-standard) and you can learn more about using them to customize Stylelint to your exact needs in our [new guide](../user-guide/customize.md).

Expand Down
7 changes: 7 additions & 0 deletions docs/migration-guide/to-16.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# Migrating to 16.0.0

This release contains breaking changes.

## Removed deprecated stylistic rules

We've removed the stylistic rules we deprecated in 15.0.0. See the [15.0.0 migration guide](./to-15.md) for details on how to migrate.
2 changes: 1 addition & 1 deletion docs/user-guide/options.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ When using the Node.js API, the autofixed code is available as the value of the

If a source contains a:

- scoped disable comment, e.g. `/* stylelint-disable indentation */`, any problems reported by the scoped rules will not be automatically fixed anywhere in the source
- scoped disable comment, e.g. `/* stylelint-disable color-named */`, any problems reported by the scoped rules will not be automatically fixed anywhere in the source
- unscoped disable comment, i.e. `/* stylelint-disable */`, the entirety of source will not be automatically fixed

This limitation in being tracked in [issue #2643](https://github.com/stylelint/stylelint/issues/2643).
Expand Down

0 comments on commit 7dc40ed

Please sign in to comment.