Skip to content

Commit bf8832a

Browse files
committed
Require Node.js 18, Stylelint 16, and move to ESM
1 parent bdcc388 commit bf8832a

File tree

4 files changed

+26
-24
lines changed

4 files changed

+26
-24
lines changed

.github/workflows/main.yml

+4-5
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,11 @@ jobs:
1010
fail-fast: false
1111
matrix:
1212
node-version:
13-
- 16
14-
- 14
15-
- 12
13+
- 20
14+
- 18
1615
steps:
17-
- uses: actions/checkout@v2
18-
- uses: actions/setup-node@v2
16+
- uses: actions/checkout@v4
17+
- uses: actions/setup-node@v4
1918
with:
2019
node-version: ${{ matrix.node-version }}
2120
- run: npm install

index.js

+7-7
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
1-
'use strict';
2-
3-
module.exports = {
1+
const config = {
42
extends: 'stylelint-config-xo',
53
rules: {
64
indentation: [
75
2,
86
{
9-
baseIndentLevel: 1
10-
}
11-
]
12-
}
7+
baseIndentLevel: 1,
8+
},
9+
],
10+
},
1311
};
12+
13+
export default config;

package.json

+9-6
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,11 @@
1010
"email": "sindresorhus@gmail.com",
1111
"url": "https://sindresorhus.com"
1212
},
13+
"type": "module",
14+
"exports": "./index.js",
15+
"sideEffects": false,
1316
"engines": {
14-
"node": ">=12"
17+
"node": ">=18"
1518
},
1619
"scripts": {
1720
"test": "xo && ava"
@@ -46,14 +49,14 @@
4649
"simple"
4750
],
4851
"dependencies": {
49-
"stylelint-config-xo": "^0.21.0"
52+
"stylelint-config-xo": "^1.0.0"
5053
},
5154
"devDependencies": {
52-
"ava": "^2.4.0",
53-
"stylelint": "^14.5.3",
54-
"xo": "^0.33.1"
55+
"ava": "^6.1.2",
56+
"stylelint": "^16.4.0",
57+
"xo": "^0.58.0"
5558
},
5659
"peerDependencies": {
57-
"stylelint": ">=14"
60+
"stylelint": ">=16"
5861
}
5962
}

test/test.js

+6-6
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,21 @@
11
import test from 'ava';
22
import stylelint from 'stylelint';
3-
import config from '..';
3+
import config from '../index.js';
44

55
const hasRule = (errors, ruleId) => errors.some(x => x.rule === ruleId);
66

77
const runStylelint = async code => {
88
const {results} = await stylelint.lint({
99
code,
10-
config
10+
config,
1111
});
1212

1313
for (const result of results) {
14-
if (result.deprecations.length !== 0) {
14+
if (result.deprecations.length > 0) {
1515
throw new Error(`Deprecations:\n${result.deprecations.join('\n')}`);
1616
}
1717

18-
if (result.invalidOptionWarnings.length !== 0) {
18+
if (result.invalidOptionWarnings.length > 0) {
1919
const warnings = result.invalidOptionWarnings.map(x => x.text).join('\n');
2020
throw new Error(`Invalid options:\n${warnings}`);
2121
}
@@ -29,8 +29,8 @@ test('main', async t => {
2929
`div {
3030
left: .2em;
3131
}
32-
`
32+
`,
3333
);
3434

35-
t.true(hasRule(results[0].warnings, 'number-leading-zero'));
35+
t.true(hasRule(results[0].warnings, '@stylistic/number-leading-zero'));
3636
});

0 commit comments

Comments
 (0)