Skip to content

Commit

Permalink
[KOA-6224] Update to Stylelint v15 and Prettier v3 (#293)
Browse files Browse the repository at this point in the history
* releases are now automated via GitHub releases and GHA, remove excess files

* remove duplicate prettier rule, that comes from extending stylelint-prettier automatically, add example comment above first rule the way we do in eslint-config-skyscanner, disable newly added declaration-block-no-redundant-longhand-properties rule that causes more churn than value

* align tests to new stylelint and prettier setup

* update to packages that support stylelint@15 and prettier@3, remove deprecated packages, add NODE_OPTIONS to support running prettier via node in jest tests while node doesn't support modules by default
  • Loading branch information
dominicfraser authored Jul 25, 2023
1 parent c47a330 commit 83b418b
Show file tree
Hide file tree
Showing 7 changed files with 1,347 additions and 554 deletions.
7 changes: 4 additions & 3 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
# Change Log

All notable changes to this project will be documented in this file.
_If `@skyscanner/eslint-config-skyscanner` has a major version change then `@skyscanner/stylelint-config-skyscanner` should also have a major version change, as explained in [the docs](./docs/eslint-as-dependency.md)_

The format is based on [Keep a Changelog](http://keepachangelog.com/) and this project adheres to [Semantic Versioning](http://semver.org/).
This file remains for historical references, but all new releases are now documented in the package's [Releases page](https://github.com/Skyscanner/eslint-config-skyscanner/releases).

[Unreleased changes](./UNRELEASED.md)
The format is based on [Keep a Changelog](http://keepachangelog.com/)
and this project adheres to [Semantic Versioning](http://semver.org/).

# 9.0.0

Expand Down
4 changes: 0 additions & 4 deletions UNRELEASED.md

This file was deleted.

11 changes: 5 additions & 6 deletions docs/release.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,11 @@ This package can be published by members of the Koala team and authorised Skysca

### Stable release

To do this:
- Add a title with the new version for changes in the `CHANGELOG.md` and copy the changes to be published from the `UNRELEASED.md` file to the new section.
- Stage those changes (`git add CHANGELOG.md UNRELEASED.md`).
- Run `npm version -f major|minor|patch`. This will create a tagged commit changing the version in `package.json`, and the changes in `CHANGELOG.md`.
- Run `npm publish --registry=https://registry.npmjs.org/`.
- Run `git push && git push --tags`.
Stable releases are now automated.

After a pull request is merged an authorised member next publishes a release via the [GitHub Release UI](https://github.com/Skyscanner/eslint-config-skyscanner/releases).

This will generate an email confirmation. Once this has been confirmed the tag and release will be generated.

### Alpha/Beta release

Expand Down
9 changes: 7 additions & 2 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,13 +27,19 @@ module.exports = {
'stylelint-prettier',
],
rules: {
// Declaring singular values of typography attributes (e.g. `font-weight`) is disallowed. Use a Backpack mixin that sets groups of attributes in sync with the overall design system
// https://github.com/Skyscanner/stylelint-plugin-backpack/blob/3acae45c28a015bbdd250b447803da1ac2ed31e8/lib/rules/use-typography-styles/index.js
'backpack/use-typography-styles': [
true,
{
severity: 'warning',
},
],
'prettier/prettier': true,

// This rule is purely about code style and the impact of code churn turning this on outweighs our perceived benefit of enforcing it
// https://stylelint.io/user-guide/rules/declaration-block-no-redundant-longhand-properties/
'declaration-block-no-redundant-longhand-properties': null,

'selector-max-id': 0,
'selector-max-type': [
0,
Expand Down Expand Up @@ -67,7 +73,6 @@ module.exports = {
'property-no-vendor-prefix': true,
'selector-no-vendor-prefix': true,
'value-no-vendor-prefix': true,
'string-quotes': 'single',
'font-family-name-quotes': 'always-where-recommended',
'at-rule-empty-line-before': [
'always',
Expand Down
16 changes: 8 additions & 8 deletions index.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ const validCss = `$kebab-case-variable: 3rem;
display: 'block';
} @else if $display == 'inline' {
display: 'inline';
} @else {
} @else {
display: 'inline-block';
}
}
Expand Down Expand Up @@ -356,12 +356,6 @@ describe('at rules errors', () => {
it('raised correct rules', () =>
result.then((data) =>
expect(data.results[0].warnings).toEqual([
expect.objectContaining({
rule: 'prettier/prettier',
}),
expect.objectContaining({
rule: 'prettier/prettier',
}),
expect.objectContaining({
rule: 'scss/at-else-closing-brace-newline-after',
}),
Expand All @@ -375,6 +369,12 @@ describe('at rules errors', () => {
expect.objectContaining({
rule: 'scss/at-if-closing-brace-space-after',
}),
expect.objectContaining({
rule: 'prettier/prettier',
}),
expect.objectContaining({
rule: 'prettier/prettier',
}),
]),
));
});
Expand Down Expand Up @@ -410,7 +410,7 @@ describe('flags use-typography-styles', () => {
// only vertical margins are allowed for non-flexible spacing
const unitsUsageCSS = `.valid-usage {
margin-top: 20px;
margin-top: 10px;
margin-top: 10rem;
margin-bottom: 100px;
padding: 20px 2rem;
padding-top: 20px;
Expand Down
Loading

0 comments on commit 83b418b

Please sign in to comment.