Skip to content

Commit 0c31026

Browse files
committed
Update development practices
1 parent c07b394 commit 0c31026

7 files changed

Lines changed: 1862 additions & 3293 deletions

File tree

.github/workflows/test.yml

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
name: Test
2+
"on":
3+
push: null
4+
pull_request: null
5+
env:
6+
FORCE_COLOR: 2
7+
jobs:
8+
full:
9+
name: Node.js 16 Full
10+
runs-on: ubuntu-latest
11+
steps:
12+
- name: Checkout the repository
13+
uses: actions/checkout@v2
14+
- name: Install Node.js
15+
uses: actions/setup-node@v2
16+
with:
17+
node-version: 16
18+
- name: Install dependencies
19+
uses: bahmutov/npm-install@v1
20+
- name: Run tests
21+
run: yarn test
22+
short:
23+
runs-on: ubuntu-latest
24+
strategy:
25+
matrix:
26+
node-version:
27+
- 14
28+
- 12
29+
name: Node.js ${{ matrix.node-version }} Quick
30+
steps:
31+
- name: Checkout the repository
32+
uses: actions/checkout@v2
33+
- name: Install Node.js ${{ matrix.node-version }}
34+
uses: actions/setup-node@v2
35+
with:
36+
node-version: ${{ matrix.node-version }}
37+
- name: Install dependencies
38+
uses: bahmutov/npm-install@v1
39+
- name: Run unit tests
40+
run: npx jest

.travis.yml

Lines changed: 0 additions & 6 deletions
This file was deleted.

lib/safe-parse.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ let { Input } = require('postcss')
22

33
let SafeParser = require('./safe-parser')
44

5-
module.exports = function safeParse (css, opts) {
5+
module.exports = function safeParse(css, opts) {
66
let input = new Input(css, opts)
77

88
let parser = new SafeParser(input)

lib/safe-parser.js

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

55
class SafeParser extends Parser {
6-
createTokenizer () {
6+
createTokenizer() {
77
this.tokenizer = tokenizer(this.input, { ignoreErrors: true })
88
}
99

10-
comment (token) {
10+
comment(token) {
1111
let node = new Comment()
1212
this.init(node, token[2])
1313
let pos =
@@ -34,29 +34,29 @@ class SafeParser extends Parser {
3434
}
3535
}
3636

37-
decl (tokens) {
37+
decl(tokens) {
3838
if (tokens.length > 1 && tokens.some(i => i[0] === 'word')) {
3939
super.decl(tokens)
4040
}
4141
}
4242

43-
unclosedBracket () {}
43+
unclosedBracket() {}
4444

45-
unknownWord (tokens) {
45+
unknownWord(tokens) {
4646
this.spaces += tokens.map(i => i[1]).join('')
4747
}
4848

49-
unexpectedClose () {
49+
unexpectedClose() {
5050
this.current.raws.after += '}'
5151
}
5252

53-
doubleColon () {}
53+
doubleColon() {}
5454

55-
unnamedAtrule (node) {
55+
unnamedAtrule(node) {
5656
node.name = ''
5757
}
5858

59-
precheckMissedSemicolon (tokens) {
59+
precheckMissedSemicolon(tokens) {
6060
let colon = this.colon(tokens)
6161
if (colon === false) return
6262

@@ -81,9 +81,9 @@ class SafeParser extends Parser {
8181
this.decl(other)
8282
}
8383

84-
checkMissedSemicolon () {}
84+
checkMissedSemicolon() {}
8585

86-
endFile () {
86+
endFile() {
8787
if (this.current.nodes && this.current.nodes.length) {
8888
this.current.raws.semicolon = this.semicolon
8989
}

package.json

Lines changed: 34 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -13,49 +13,55 @@
1313
"license": "MIT",
1414
"repository": "postcss/postcss-safe-parser",
1515
"scripts": {
16-
"test": "jest-ci --coverage && eslint-ci . && ./test/integration.js"
16+
"test": "jest --coverage && eslint . && ./test/integration.js"
1717
},
1818
"engines": {
19-
"node": ">=10.0"
19+
"node": ">=12.0"
2020
},
2121
"main": "lib/safe-parse",
2222
"funding": {
2323
"type": "opencollective",
2424
"url": "https://opencollective.com/postcss/"
2525
},
26-
"dependencies": {
27-
"postcss": "^8.1.0"
26+
"peerDependencies": {
27+
"postcss": "^8.2.14"
2828
},
2929
"devDependencies": {
30-
"@logux/eslint-config": "^40.0.5",
31-
"ci-job-number": "^1.2.2",
32-
"clean-publish": "^1.1.8",
33-
"eslint": "^7.10.0",
34-
"eslint-ci": "^1.0.0",
35-
"eslint-config-standard": "^14.1.1",
36-
"eslint-plugin-import": "^2.22.0",
37-
"eslint-plugin-jest": "^24.0.2",
30+
"@logux/eslint-config": "^45.4.4",
31+
"clean-publish": "^2.2.0",
32+
"eslint": "^7.28.0",
33+
"eslint-config-standard": "^16.0.3",
34+
"eslint-plugin-import": "^2.23.4",
35+
"eslint-plugin-jest": "^24.3.6",
3836
"eslint-plugin-node": "^11.1.0",
3937
"eslint-plugin-prefer-let": "^1.1.0",
40-
"eslint-plugin-prettierx": "^0.14.0",
41-
"eslint-plugin-promise": "^4.2.1",
38+
"eslint-plugin-promise": "^5.1.0",
4239
"eslint-plugin-security": "^1.4.0",
43-
"eslint-plugin-standard": "^4.0.1",
44-
"eslint-plugin-unicorn": "^22.0.0",
45-
"husky": "^4.3.0",
46-
"jest": "^26.4.2",
47-
"jest-ci": "^0.1.1",
48-
"lint-staged": "^10.4.0",
49-
"postcss-parser-tests": "^8.3.1",
50-
"postcss-sharec-config": "^0.1.8"
40+
"eslint-plugin-unicorn": "^33.0.1",
41+
"jest": "^27.0.4",
42+
"lint-staged": "^11.0.0",
43+
"postcss": "^8.3.3",
44+
"postcss-parser-tests": "^8.3.5",
45+
"postcss-sharec-config": "^0.4.1",
46+
"prettier": "^2.2.1",
47+
"simple-git-hooks": "^2.4.1"
5148
},
52-
"husky": {
53-
"hooks": {
54-
"pre-commit": "lint-staged"
55-
}
49+
"simple-git-hooks": {
50+
"pre-commit": "npx lint-staged"
51+
},
52+
"prettier": {
53+
"arrowParens": "avoid",
54+
"jsxSingleQuote": false,
55+
"quoteProps": "consistent",
56+
"semi": false,
57+
"singleQuote": true,
58+
"trailingComma": "none"
5659
},
5760
"lint-staged": {
58-
"*.js": "eslint --fix"
61+
"*.js": [
62+
"prettier --write",
63+
"eslint --fix"
64+
]
5965
},
6066
"eslintConfig": {
6167
"extends": "@logux/eslint-config"
@@ -70,6 +76,6 @@
7076
},
7177
"sharec": {
7278
"config": "postcss-sharec-config",
73-
"version": "0.1.8"
79+
"version": "0.4.1"
7480
}
7581
}

test/integration.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
#!/usr/bin/env node
22

33
let { testOnReal } = require('postcss-parser-tests')
4-
let ciJobNumber = require('ci-job-number')
54

65
let safe = require('../lib/safe-parse')
76

8-
if (ciJobNumber() === 1) {
9-
testOnReal(css => safe(css).toResult({ map: { annotation: false } }), [
7+
testOnReal(
8+
css => safe(css).toResult({ map: { annotation: false } }),
9+
[
1010
'https://raw.githubusercontent.com/' +
1111
'4ae9b8/browserhacks/gh-pages/assets/css/tests.css'
12-
])
13-
}
12+
]
13+
)

0 commit comments

Comments
 (0)