Skip to content

Commit

Permalink
Support for Stylelint v14.4 (#23)
Browse files Browse the repository at this point in the history
* Support for stylelint v14.4

* add test
  • Loading branch information
ota-meshi committed Feb 9, 2022
1 parent bb682c4 commit e576055
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 1 deletion.
16 changes: 16 additions & 0 deletions .github/workflows/NodeCI.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,3 +33,19 @@ jobs:
run: npm i --legacy-peer-deps
- name: Test
run: npm test
test-old-vers:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v2
with:
node-version: 14.x
- name: Downgrade Packages
run: |
npm install --save-exact stylelint@14.0.0 --legacy-peer-deps
npm install --save-exact stylelint-config-recommended@6.0.0 --legacy-peer-deps
npx rimraf node_modules
- name: Install Packages
run: npm i --legacy-peer-deps
- name: Test
run: npm test
13 changes: 13 additions & 0 deletions lib/vue-specific-rules.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,13 @@
"use strict"

const semver = require("semver")
let stylelintVersion = "14.4.0"
try {
stylelintVersion = require("stylelint/package.json").version
} catch {
// ignore
}

module.exports = {
"selector-pseudo-class-no-unknown": [
true,
Expand All @@ -13,4 +21,9 @@ module.exports = {
ignorePseudoElements: ["v-deep", "v-global", "v-slotted"],
},
],
...(semver.gte(stylelintVersion, "14.4.0")
? {
"function-no-unknown": null,
}
: {}),
}
4 changes: 3 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
"preversion": "npm test && git add ."
},
"dependencies": {
"semver": "^7.3.5",
"stylelint-config-html": ">=1.0.0",
"stylelint-config-recommended": ">=6.0.0"
},
Expand All @@ -43,7 +44,8 @@
"eslint-plugin-vue": "^8.0.0",
"eslint-plugin-yml": "^0.13.0",
"mocha": "^9.1.3",
"prettier": "^2.4.1"
"prettier": "^2.4.1",
"stylelint": "^14.4.0"
},
"repository": {
"type": "git",
Expand Down

0 comments on commit e576055

Please sign in to comment.