diff --git a/.travis.yml b/.travis.yml index d30a2a8..62105ca 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,8 +1,9 @@ sudo: false language: node_js node_js: - - "5.1.0" - - "4.2.2" + - "6" + - "5" + - "4" after_script: - './node_modules/.bin/nyc report --reporter=text-lcov | ./node_modules/.bin/coveralls' diff --git a/package.json b/package.json index 50b4fa1..929d733 100644 --- a/package.json +++ b/package.json @@ -1,10 +1,10 @@ { "name": "postcss-attribute-selector-prefix", - "version": "0.0.3", + "version": "0.0.4", "description": "A attribute selector prefixer for postcss", "main": "./lib/index.js", "scripts": { - "test": "xo ./src/*.js ./test/*.js && nyc ava", + "test": "eslint --format=node_modules/eslint-formatter-pretty ./src/*.js ./test/*.js && nyc ava", "clean": "rm -rf lib && mkdir lib", "build": "npm run clean && babel src/index.js --out-file lib/index.js && npm t", "prepublish": "npm run build", @@ -39,18 +39,35 @@ "babel-register" ] }, + "eslintConfig": { + "plugins": [ + "ava", + "xo", + "babel" + ], + "extends": [ + "xo", + "plugin:xo/recommended", + "plugin:ava/recommended" + ] + }, "dependencies": { "postcss": "^5.0.19" }, "devDependencies": { "ava": "^0.14.0", "babel-cli": "^6.7.7", - "babel-plugin-add-module-exports": "^0.1.2", + "babel-plugin-add-module-exports": "^0.1.4", "babel-preset-node5": "^11.0.2", "babel-register": "^6.7.2", "coveralls": "^2.11.9", + "eslint": "^2.8.0", + "eslint-config-xo": "^0.13.0", + "eslint-formatter-pretty": "^0.2.1", + "eslint-plugin-ava": "^2.2.1", + "eslint-plugin-babel": "^3.2.0", + "eslint-plugin-xo": "^0.3.1", "nyc": "^6.4.0", - "updtr": "^0.1.10", - "xo": "^0.13.0" + "updtr": "^0.1.10" } } diff --git a/src/index.js b/src/index.js index 4749414..a805a7f 100644 --- a/src/index.js +++ b/src/index.js @@ -5,7 +5,7 @@ const filter = (filter, attributeSelector) => new RegExp(filter.map(attribut => export default postcss.plugin('postcss-attribute-selector-prefix', options => { return nodes => { return nodes.walkRules(rule => { - rule.selector = rule.selector.replace(/\[.*?\]/g, (match) => { + rule.selector = rule.selector.replace(/\[.*?\]/g, match => { if (options.prefix === undefined) { return match; } diff --git a/test/test-plugin.js b/test/test-plugin.js index b6086f8..16647e2 100644 --- a/test/test-plugin.js +++ b/test/test-plugin.js @@ -28,7 +28,7 @@ test('processing options prefix, filter and attribute selector', t => { t.is(processing(fixtures, {prefix: 'test-', filter: ['class']}), expected); }); -test('processing options prefix, filter and attribute selector', t => { +test('processing options prefix, filter and attribute selector witch indentical class filter', t => { const expected = '.class, [type="text"], [alt*="class"] { color:red; }'; const fixtures = '.class, [type="text"], [alt*="class"] { color:red; }'; t.is(processing(fixtures, {prefix: 'test-', filter: ['class']}), expected);