Skip to content

Commit cb8fcdc

Browse files
committed
Update dependencies and practies
1 parent abf10f9 commit cb8fcdc

4 files changed

Lines changed: 592 additions & 315 deletions

File tree

.github/workflows/test.yml

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -12,15 +12,15 @@ jobs:
1212
runs-on: ubuntu-latest
1313
steps:
1414
- name: Checkout the repository
15-
uses: actions/checkout@v3
15+
uses: actions/checkout@v4
1616
- name: Install pnpm
1717
uses: pnpm/action-setup@v2
1818
with:
19-
version: latest
19+
version: 8
2020
- name: Install Node.js
2121
uses: actions/setup-node@v3
2222
with:
23-
node-version: 19
23+
node-version: 20
2424
cache: pnpm
2525
- name: Install dependencies
2626
run: pnpm install --frozen-lockfile --ignore-scripts
@@ -33,15 +33,14 @@ jobs:
3333
node-version:
3434
- 18
3535
- 16
36-
- 14
3736
name: Node.js ${{ matrix.node-version }} Quick
3837
steps:
3938
- name: Checkout the repository
40-
uses: actions/checkout@v3
39+
uses: actions/checkout@v4
4140
- name: Install pnpm
4241
uses: pnpm/action-setup@v2
4342
with:
44-
version: latest
43+
version: 8
4544
- name: Install Node.js ${{ matrix.node-version }}
4645
uses: actions/setup-node@v3
4746
with:
@@ -56,11 +55,12 @@ jobs:
5655
strategy:
5756
matrix:
5857
node-version:
58+
- 14
5959
- 12
6060
name: Node.js ${{ matrix.node-version }} Quick
6161
steps:
6262
- name: Checkout the repository
63-
uses: actions/checkout@v3
63+
uses: actions/checkout@v4
6464
- name: Install pnpm
6565
uses: pnpm/action-setup@v1
6666
with:
@@ -72,6 +72,6 @@ jobs:
7272
with:
7373
node-version: ${{ matrix.node-version }}
7474
- name: Install dependencies
75-
run: pnpm install --frozen-lockfile --ignore-scripts
75+
run: pnpm install --no-frozen-lockfile --ignore-scripts
7676
- name: Run unit tests
7777
run: pnpm unit

lib/safe-parser.js

Lines changed: 28 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,7 @@ let Comment = require('postcss/lib/comment')
33
let Parser = require('postcss/lib/parser')
44

55
class SafeParser extends Parser {
6-
createTokenizer() {
7-
this.tokenizer = tokenizer(this.input, { ignoreErrors: true })
8-
}
6+
checkMissedSemicolon() {}
97

108
comment(token) {
119
let node = new Comment()
@@ -14,9 +12,9 @@ class SafeParser extends Parser {
1412
this.input.fromOffset(token[3]) ||
1513
this.input.fromOffset(this.input.css.length - 1)
1614
node.source.end = {
17-
offset: token[3],
15+
column: pos.col,
1816
line: pos.line,
19-
column: pos.col
17+
offset: token[3] + 1
2018
}
2119

2220
let text = token[1].slice(2)
@@ -34,26 +32,29 @@ class SafeParser extends Parser {
3432
}
3533
}
3634

35+
createTokenizer() {
36+
this.tokenizer = tokenizer(this.input, { ignoreErrors: true })
37+
}
38+
3739
decl(tokens) {
3840
if (tokens.length > 1 && tokens.some(i => i[0] === 'word')) {
3941
super.decl(tokens)
4042
}
4143
}
4244

43-
unclosedBracket() {}
44-
45-
unknownWord(tokens) {
46-
this.spaces += tokens.map(i => i[1]).join('')
47-
}
48-
49-
unexpectedClose() {
50-
this.current.raws.after += '}'
51-
}
52-
5345
doubleColon() {}
5446

55-
unnamedAtrule(node) {
56-
node.name = ''
47+
endFile() {
48+
if (this.current.nodes && this.current.nodes.length) {
49+
this.current.raws.semicolon = this.semicolon
50+
}
51+
this.current.raws.after = (this.current.raws.after || '') + this.spaces
52+
53+
while (this.current.parent) {
54+
this.current = this.current.parent
55+
this.current.raws.after = ''
56+
}
57+
this.root.source.end = this.getPosition(this.tokenizer.position())
5758
}
5859

5960
precheckMissedSemicolon(tokens) {
@@ -81,18 +82,18 @@ class SafeParser extends Parser {
8182
this.decl(other)
8283
}
8384

84-
checkMissedSemicolon() {}
85+
unclosedBracket() {}
8586

86-
endFile() {
87-
if (this.current.nodes && this.current.nodes.length) {
88-
this.current.raws.semicolon = this.semicolon
89-
}
90-
this.current.raws.after = (this.current.raws.after || '') + this.spaces
87+
unexpectedClose() {
88+
this.current.raws.after += '}'
89+
}
9190

92-
while (this.current.parent) {
93-
this.current = this.current.parent
94-
this.current.raws.after = ''
95-
}
91+
unknownWord(tokens) {
92+
this.spaces += tokens.map(i => i[1]).join('')
93+
}
94+
95+
unnamedAtrule(node) {
96+
node.name = ''
9697
}
9798
}
9899

package.json

Lines changed: 14 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,10 @@
1414
"repository": "postcss/postcss-safe-parser",
1515
"scripts": {
1616
"unit": "uvu . '\\.test\\.js$'",
17-
"test": "pnpm unit && eslint . && ./test/integration.js"
17+
"test:unit": "pnpm unit",
18+
"test:lint": "eslint .",
19+
"test:integration": "node test/integration.js",
20+
"test": "pnpm run /^test:/"
1821
},
1922
"engines": {
2023
"node": ">=12.0"
@@ -38,16 +41,18 @@
3841
"postcss": "^8.3.3"
3942
},
4043
"devDependencies": {
41-
"@logux/eslint-config": "^49.0.0",
42-
"clean-publish": "^4.1.1",
43-
"eslint": "^8.36.0",
44-
"eslint-config-standard": "^17.0.0",
45-
"eslint-plugin-import": "^2.27.5",
46-
"eslint-plugin-n": "^15.6.1",
44+
"@logux/eslint-config": "^52.0.1",
45+
"clean-publish": "^4.2.0",
46+
"eslint": "^8.51.0",
47+
"eslint-config-standard": "^17.1.0",
48+
"eslint-plugin-import": "^2.28.1",
49+
"eslint-plugin-n": "^16.1.0",
50+
"eslint-plugin-node-import": "^1.0.4",
51+
"eslint-plugin-perfectionist": "^2.1.0",
4752
"eslint-plugin-prefer-let": "^3.0.1",
4853
"eslint-plugin-promise": "^6.1.1",
49-
"postcss": "^8.4.21",
50-
"postcss-parser-tests": "^8.5.2",
54+
"postcss": "^8.4.31",
55+
"postcss-parser-tests": "^8.8.0",
5156
"uvu": "^0.5.6"
5257
},
5358
"prettier": {

0 commit comments

Comments
 (0)