Skip to content

Commit a96a660

Browse files
committed
3.0.0 (switch to postcss 5.x)
1 parent 5c3f711 commit a96a660

File tree

5 files changed

+29
-25
lines changed

5 files changed

+29
-25
lines changed

.eslintrc

+10-5
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,9 @@
22
# babel support more syntax stuff than eslint for now
33
parser: babel-eslint
44

5+
root: true
6+
extends: eslint:recommended
7+
58
ecmaFeatures:
69
modules: true
710

@@ -20,18 +23,20 @@ rules:
2023
brace-style: [2, "stroustrup"]
2124
comma-dangle: [2, "always-multiline"]
2225
comma-style: [2, "last"]
23-
computed-property-spacing: [2, "never"]
2426
dot-location: [2, "property"]
2527

2628
one-var: [2, "never"]
27-
#no-var: [2]
29+
no-var: [2]
2830
prefer-const: [2]
2931
no-bitwise: [2]
3032

31-
object-shorthand: [2, "methods"]
33+
object-curly-spacing: [2, "never"]
34+
array-bracket-spacing: [2, "never"]
35+
computed-property-spacing: [2, "never"]
36+
37+
space-unary-ops: [2, {"words": true, "nonwords": false}]
3238
space-after-keywords: [2, "always"]
3339
space-before-blocks: [2, "always"]
3440
space-before-function-paren: [2, "never"]
35-
space-in-brackets: [2, "never"]
3641
space-in-parens: [2, "never"]
37-
spaced-line-comment: [2, "always"]
42+
spaced-comment: [2, "always"]

CHANGELOG.md

+5
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
# 3.0.0 - 2015-08-25
2+
3+
- Removed: compatibility with postcss v4.x
4+
- Added: compatibility with postcss v5.x
5+
16
# 2.3.0 - 2015-07-14
27

38
* Fixed: Nested/mixed selectors now works correctly

package.json

+5-11
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "postcss-custom-selectors",
3-
"version": "2.3.0",
3+
"version": "3.0.0",
44
"description": "PostCSS plugin to transform W3C CSS Extensions(Custom Selectors) to more compatible CSS",
55
"keywords": [
66
"postcss",
@@ -18,27 +18,21 @@
1818
"type": "git",
1919
"url": "https://github.com/postcss/postcss-custom-selectors.git"
2020
},
21-
"homepage": "https://github.com/postcss/postcss-custom-selectors",
22-
"bugs": {
23-
"url": "https://github.com/postcss/postcss-custom-selectors/issues"
24-
},
21+
"main": "dist/index.js",
2522
"files": [
26-
"CHANGELOG.md",
27-
"LICENSE",
2823
"dist",
2924
"README-zh.md"
3025
],
31-
"main": "dist/index.js",
3226
"dependencies": {
3327
"balanced-match": "^0.2.0",
34-
"postcss": "^4.1.7",
35-
"postcss-selector-matches": "^1.2.1"
28+
"postcss": "^5.0.0",
29+
"postcss-selector-matches": "^2.0.0"
3630
},
3731
"devDependencies": {
3832
"babel": "^5.5.8",
3933
"babel-eslint": "^3.1.15",
4034
"babel-tape-runner": "^1.1.0",
41-
"eslint": "^0.23.0",
35+
"eslint": "^1.0.0",
4236
"tape": "^4.0.0"
4337
},
4438
"scripts": {

src/index.js

+5-5
Original file line numberDiff line numberDiff line change
@@ -18,16 +18,16 @@ export default postcss.plugin("postcss-custom-selectors", function(options) {
1818

1919
const transformMatchesOnRule = transformMatches
2020
? (rule) => replaceRuleSelector(rule, {
21-
lineBreak,
22-
})
21+
lineBreak,
22+
})
2323
: (rule) => rule.selector
2424

2525
return function(css, result) {
2626
const toRemove = []
2727
const customSelectors = {}
2828

2929
// first, read custom selectors
30-
css.eachAtRule(function(rule) {
30+
css.walkAtRules(function(rule) {
3131
if (rule.name !== "custom-selector") {
3232
return
3333
}
@@ -47,7 +47,7 @@ export default postcss.plugin("postcss-custom-selectors", function(options) {
4747
})
4848

4949
// Convert those selectors to :matches()
50-
css.eachRule(function(rule) {
50+
css.walkRules(function(rule) {
5151
if (rule.selector.indexOf(":--") > -1) {
5252
rule.selector = rule.selector.replace(
5353
CUSTOM_SELECTOR_RE,
@@ -71,7 +71,7 @@ export default postcss.plugin("postcss-custom-selectors", function(options) {
7171
})
7272

7373
toRemove.forEach(function(rule) {
74-
rule.removeSelf()
74+
rule.remove()
7575
})
7676

7777
}

test/index.js

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
var test = require("tape")
2-
var postcss = require("postcss")
3-
var plugin = require("../src")
1+
import test from "tape"
2+
import postcss from "postcss"
3+
import plugin from "../src"
44

55
function transform(input, opts = {}, postcssOpts = {}) {
66
return postcss()
@@ -268,7 +268,7 @@ main #nav .bar + p {
268268
"should transform local extensions"
269269
)
270270

271-
var postcssPlugin = postcss().use(plugin())
271+
const postcssPlugin = postcss().use(plugin())
272272
t.ok(
273273
postcssPlugin.process("@custom-selector :--foobar .foo;:--foobar{}").css,
274274
"should not create a memory"

0 commit comments

Comments
 (0)