Skip to content

Commit 7701aed

Browse files
committed
Migrate @logux/eslin-config from 45.1.0 to 45.4.4
1 parent 9ccc3fa commit 7701aed

File tree

4 files changed

+344
-872
lines changed

4 files changed

+344
-872
lines changed

index.js

+8-8
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
let parser = require('postcss-selector-parser')
22

3-
function parse (str, rule) {
3+
function parse(str, rule) {
44
let nodes
55
let saver = parser(parsed => {
66
nodes = parsed
@@ -17,7 +17,7 @@ function parse (str, rule) {
1717
return nodes.at(0)
1818
}
1919

20-
function replace (nodes, parent) {
20+
function replace(nodes, parent) {
2121
let replaced = false
2222
nodes.each(i => {
2323
if (i.type === 'nesting') {
@@ -37,7 +37,7 @@ function replace (nodes, parent) {
3737
return replaced
3838
}
3939

40-
function selectors (parent, child) {
40+
function selectors(parent, child) {
4141
let result = []
4242
parent.selectors.forEach(i => {
4343
let parentNode = parse(i, parent)
@@ -57,7 +57,7 @@ function selectors (parent, child) {
5757
return result
5858
}
5959

60-
function pickComment (comment, after) {
60+
function pickComment(comment, after) {
6161
if (comment && comment.type === 'comment') {
6262
after.after(comment)
6363
return comment
@@ -66,7 +66,7 @@ function pickComment (comment, after) {
6666
}
6767
}
6868

69-
function atruleChilds (rule, atrule, bubbling) {
69+
function atruleChilds(rule, atrule, bubbling) {
7070
let children = []
7171
atrule.each(child => {
7272
if (child.type === 'comment') {
@@ -90,7 +90,7 @@ function atruleChilds (rule, atrule, bubbling) {
9090
}
9191
}
9292

93-
function pickDeclarations (selector, declarations, after, Rule) {
93+
function pickDeclarations(selector, declarations, after, Rule) {
9494
let parent = new Rule({
9595
selector,
9696
nodes: []
@@ -104,7 +104,7 @@ function pickDeclarations (selector, declarations, after, Rule) {
104104
return parent
105105
}
106106

107-
function atruleNames (defaults, custom) {
107+
function atruleNames(defaults, custom) {
108108
let list = {}
109109
for (let i of defaults) {
110110
list[i] = true
@@ -134,7 +134,7 @@ module.exports = (opts = {}) => {
134134

135135
return {
136136
postcssPlugin: 'postcss-nested',
137-
Rule (rule, { Rule }) {
137+
Rule(rule, { Rule }) {
138138
let unwrapped = false
139139
let after = rule
140140
let copyDeclarations = false

index.test.js

+5-9
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ let postcss = require('postcss')
22

33
let plugin = require('./')
44

5-
function run (input, output, opts) {
5+
function run(input, output, opts) {
66
let result = postcss([plugin(opts)]).process(input, { from: '/test.css' })
77
expect(result.css).toEqual(output)
88
expect(result.warnings()).toHaveLength(0)
@@ -211,16 +211,14 @@ it('works with other visitors', () => {
211211
return {
212212
postcssPlugin: 'mixin',
213213
AtRule: {
214-
mixin (node) {
214+
mixin(node) {
215215
node.replaceWith('.in{.deep{color:blue}}')
216216
}
217217
}
218218
}
219219
}
220220
mixinPlugin.postcss = true
221-
let out = postcss([plugin, mixinPlugin]).process(css, {
222-
from: undefined
223-
}).css
221+
let out = postcss([plugin, mixinPlugin]).process(css, { from: undefined }).css
224222
expect(out).toEqual('a b{color:red}a .in .deep{color:blue}')
225223
})
226224

@@ -230,16 +228,14 @@ it('works with other visitors #2', () => {
230228
return {
231229
postcssPlugin: 'mixin',
232230
AtRule: {
233-
mixin (node) {
231+
mixin(node) {
234232
node.replaceWith('.in { .deep {color:blue} }')
235233
}
236234
}
237235
}
238236
}
239237
mixinPlugin.postcss = true
240-
let out = postcss([plugin, mixinPlugin]).process(css, {
241-
from: undefined
242-
}).css
238+
let out = postcss([plugin, mixinPlugin]).process(css, { from: undefined }).css
243239
expect(out).toEqual('a .in .deep {color:blue} a b {color:red}')
244240
})
245241

package.json

+23-11
Original file line numberDiff line numberDiff line change
@@ -29,39 +29,51 @@
2929
"postcss-selector-parser": "^6.0.4"
3030
},
3131
"devDependencies": {
32-
"@logux/eslint-config": "^45.1.0",
32+
"@logux/eslint-config": "^45.4.4",
3333
"check-dts": "^0.4.4",
3434
"clean-publish": "^1.1.9",
35-
"eslint": "^7.21.0",
36-
"eslint-config-standard": "^16.0.2",
37-
"eslint-plugin-import": "^2.22.1",
38-
"eslint-plugin-jest": "^24.1.5",
35+
"eslint": "^7.28.0",
36+
"eslint-config-standard": "^16.0.3",
37+
"eslint-plugin-import": "^2.23.4",
38+
"eslint-plugin-jest": "^24.3.6",
3939
"eslint-plugin-node": "^11.1.0",
4040
"eslint-plugin-prefer-let": "^1.1.0",
41-
"eslint-plugin-prettierx": "^0.17.1",
42-
"eslint-plugin-promise": "^4.3.1",
41+
"eslint-plugin-promise": "^5.1.0",
4342
"eslint-plugin-security": "^1.4.0",
44-
"eslint-plugin-unicorn": "^28.0.2",
43+
"eslint-plugin-unicorn": "^33.0.1",
4544
"husky": "^4.3.5",
4645
"jest": "^26.6.3",
4746
"lint-staged": "^10.5.4",
4847
"postcss": "^8.2.7",
49-
"postcss-sharec-config": "^0.2.2"
48+
"postcss-sharec-config": "^0.2.2",
49+
"prettier": "^2.3.1"
5050
},
5151
"husky": {
5252
"hooks": {
5353
"pre-commit": "lint-staged"
5454
}
5555
},
5656
"lint-staged": {
57-
"*.js": "eslint --fix"
57+
"*.js": [
58+
"prettier --write",
59+
"eslint --fix"
60+
]
5861
},
5962
"eslintConfig": {
6063
"extends": "@logux/eslint-config",
6164
"rules": {
62-
"unicorn/better-regex": "off"
65+
"unicorn/better-regex": "off",
66+
"import/order": "off"
6367
}
6468
},
69+
"prettier": {
70+
"arrowParens": "avoid",
71+
"jsxSingleQuote": false,
72+
"quoteProps": "consistent",
73+
"semi": false,
74+
"singleQuote": true,
75+
"trailingComma": "none"
76+
},
6577
"jest": {
6678
"testEnvironment": "node",
6779
"coverageThreshold": {

0 commit comments

Comments
 (0)