Skip to content

Commit 5eee0eb

Browse files
committed
Add Stylelint v16 support
* Remove Node v14 and v16 support (EOL) * Set minimum Node version required for Stylelint v16 in engines field * Silence CJS deprecation warnings * Fix segmentation fault with test runner
1 parent dd73f4b commit 5eee0eb

File tree

6 files changed

+29
-17
lines changed

6 files changed

+29
-17
lines changed

.github/workflows/build.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,8 @@ jobs:
1414
strategy:
1515
fail-fast: false
1616
matrix:
17-
node-version: [14, 16, 18]
18-
stylelint: [14, 15]
17+
node-version: [18, 20]
18+
stylelint: [14, 15, 16]
1919

2020
steps:
2121
- name: Checkout
@@ -52,7 +52,7 @@ jobs:
5252
- name: Setup Node
5353
uses: actions/setup-node@v3
5454
with:
55-
node-version: 18
55+
node-version: 20
5656

5757
- name: Install dependencies
5858
run: npm install

README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -73,17 +73,17 @@ a {
7373

7474
Refer to [css-property-sort-order-smacss](https://github.com/cahamilton/css-property-sort-order-smacss/blob/v2.2.0/index.js) for the comprehensive list of property orders.
7575

76-
For more information on configuring Stylelint, check out the [configuration](https://github.com/stylelint/stylelint/blob/15.0.0/docs/user-guide/configure.md) guide.
76+
For more information on configuring Stylelint, check out the [configuration](https://github.com/stylelint/stylelint/blob/16.0.0/docs/user-guide/configure.md) guide.
7777

7878
## Advanced
7979

8080
**This is currently only possible with an exported JavaScript configuration.**
8181

82-
The basic usage outlined above, will enforce that properties are **strictly** sorted within their groups (box, border, background etc). Given this configuration makes use of [stylelint-order](https://github.com/hudochenkov/stylelint-order/tree/5.0.0) under the hood, there's a couple extra bits of functionality that can be configured. This will require manually generating the configuration - but passing in extra options as seen fit. These will be applied to **each** property group.
82+
The basic usage outlined above, will enforce that properties are **strictly** sorted within their groups (box, border, background etc). Given this configuration makes use of [stylelint-order](https://github.com/hudochenkov/stylelint-order/tree/6.0.4) under the hood, there's a couple extra bits of functionality that can be configured. This will require manually generating the configuration - but passing in extra options as seen fit. These will be applied to **each** property group.
8383

8484
### Options
8585

86-
Refer to the [properties-order](https://github.com/hudochenkov/stylelint-order/blob/5.0.0/rules/properties-order/README.md#options) documentation for a list of available options.
86+
Refer to the [properties-order](https://github.com/hudochenkov/stylelint-order/blob/6.0.4/rules/properties-order/README.md#options) documentation for a list of available options.
8787

8888
All options except `properties` and `groupName` can be modified.
8989

__tests__/generate.test.js

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,14 @@
11
/** @format */
22

3-
const generate = require('../generate');
3+
const proxyquire = require('proxyquire');
44

5-
jest.mock('css-property-sort-order-smacss', () => ({
6-
groupA: [['prop1', 'prop2'], ['prop3']],
7-
groupB: ['prop4', 'prop5', 'prop6', 'prop7'],
8-
groupC: [['prop8', 'prop9', 'prop10']],
9-
}));
5+
const generate = proxyquire.noCallThru().load('../generate', {
6+
'css-property-sort-order-smacss': {
7+
groupA: [['prop1', 'prop2'], ['prop3']],
8+
groupB: ['prop4', 'prop5', 'prop6', 'prop7'],
9+
groupC: [['prop8', 'prop9', 'prop10']],
10+
},
11+
});
1012

1113
describe('generate options', () => {
1214
it('should correctly group properties', () => {

__tests__/index.test.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,11 @@ const index = require('../index');
1111
* @return {Promise<{errored, invalidOptionWarnings, warnings}>}
1212
*/
1313
const lintCode = async ({ code, config }) => {
14-
const actual = await stylelint.lint({ code, config });
14+
const actual = await stylelint.lint({
15+
code,
16+
config,
17+
quietDeprecationWarnings: true,
18+
});
1519

1620
const { errored, results } = actual;
1721
const { invalidOptionWarnings, warnings } = results[0];

jest.config.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
/** @format */
22

33
module.exports = {
4+
runner: 'jest-light-runner',
45
cacheDirectory: '/tmp/jest/',
56
collectCoverage: true,
67
coverageDirectory: 'coverage',

package.json

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,13 @@
77
"index.js",
88
"generate.js"
99
],
10+
"engines": {
11+
"node": ">=18.12.0"
12+
},
1013
"scripts": {
1114
"coverage": "coveralls < coverage/lcov.info",
1215
"eslint": "eslint .",
13-
"jest": "jest",
16+
"jest": "NODE_OPTIONS=\"--experimental-vm-modules --no-warnings\" jest",
1417
"prettier": "prettier --check '**/*.js'",
1518
"test": "npm run eslint && npm run prettier && npm run jest"
1619
},
@@ -35,7 +38,7 @@
3538
"homepage": "https://github.com/cahamilton/stylelint-config-property-sort-order-smacss#readme",
3639
"dependencies": {
3740
"css-property-sort-order-smacss": "~2.2.0",
38-
"stylelint-order": "^6.0.2"
41+
"stylelint-order": "^6.0.4"
3942
},
4043
"devDependencies": {
4144
"coveralls": "^3.1.0",
@@ -44,10 +47,12 @@
4447
"eslint-config-prettier": "^9.0.0",
4548
"eslint-plugin-import": "^2.25.2",
4649
"jest": "^29.0.1",
50+
"jest-light-runner": "^0.6.0",
4751
"prettier": "^3.0.0",
48-
"stylelint": "^14.0.0 || ^15.0.0"
52+
"proxyquire": "^2.0.0",
53+
"stylelint": "^14.0.0 || ^15.0.0 || ^16.0.0"
4954
},
5055
"peerDependencies": {
51-
"stylelint": "^14.0.0 || ^15.0.0"
56+
"stylelint": "^14.0.0 || ^15.0.0 || ^16.0.0"
5257
}
5358
}

0 commit comments

Comments
 (0)