-
-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Follow stylelint-config-recommended-scss v6 (#29)
* Support for stylelint-scss v4.2 * fix tests * update * update test * fix
- Loading branch information
Showing
26 changed files
with
230 additions
and
212 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
"use strict" | ||
|
||
const path = require("path") | ||
|
||
/** | ||
* Gets the module version from package name | ||
*/ | ||
module.exports = function getModuleVersion(...moduleNames) { | ||
const packageName = moduleNames.pop() | ||
|
||
let ownerModuleRootPath = process.cwd() | ||
for (const ownerNames of moduleNames) { | ||
ownerModuleRootPath = | ||
getModuleRootPath(ownerNames, ownerModuleRootPath) || | ||
ownerModuleRootPath | ||
} | ||
try { | ||
const m = require("module") | ||
const relativeTo = path.join(ownerModuleRootPath, "__placeholder__.js") | ||
// eslint-disable-next-line node/no-unsupported-features/node-builtins -- ignore | ||
return m.createRequire(relativeTo)(`${packageName}/package.json`) | ||
.version | ||
} catch { | ||
// ignore | ||
} | ||
try { | ||
return require(`${packageName}/package.json`).version | ||
} catch { | ||
// ignore | ||
} | ||
|
||
return null | ||
} | ||
|
||
/** | ||
* Get module root path | ||
*/ | ||
function getModuleRootPath(packageName, ownerModuleRootPath) { | ||
try { | ||
const m = require("module") | ||
const relativeTo = path.join(ownerModuleRootPath, "__placeholder__.js") | ||
|
||
return path.dirname( | ||
// eslint-disable-next-line node/no-unsupported-features/node-builtins -- ignore | ||
m.createRequire(relativeTo).resolve(`${packageName}/package.json`), | ||
) | ||
} catch { | ||
// ignore | ||
} | ||
try { | ||
return path.dirname(require.resolve(`${packageName}/package.json`)) | ||
} catch { | ||
// ignore | ||
} | ||
|
||
return null | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
"use strict" | ||
|
||
const baseRules = require("./vue-specific-rules") | ||
|
||
module.exports = { | ||
...baseRules, | ||
...(baseRules["function-no-unknown"] | ||
? { "function-no-unknown": null } | ||
: {}), | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
package-lock=false |
15 changes: 15 additions & 0 deletions
15
tests/fixtures/integrations/function-no-unknown/package.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
{ | ||
"name": "stylelint-config-recommended-vue-test-stylelint", | ||
"private": true, | ||
"version": "1.0.0", | ||
"description": "", | ||
"devDependencies": { | ||
"postcss-html": "^1.0.0", | ||
"stylelint": "^14.5.0", | ||
"stylelint-config-recommended": "^7.0.0", | ||
"stylelint-config-recommended-vue": "file:../../../../stylelint-config-recommended-vue-test.tgz" | ||
}, | ||
"engines": { | ||
"node": "^12 || >=14" | ||
} | ||
} |
File renamed without changes.
14 changes: 14 additions & 0 deletions
14
tests/fixtures/integrations/function-no-unknown/src/valid.vue
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
<style> | ||
a { | ||
color: v-bind(color); | ||
} | ||
:global(.foo), | ||
::v-deep(.foo), | ||
::v-slotted(.foo), | ||
::v-global(.foo), | ||
:deep(.foo), | ||
:slotted(.foo) { | ||
color: red; | ||
} | ||
</style> |
5 changes: 5 additions & 0 deletions
5
tests/fixtures/integrations/function-no-unknown/stylelint.config.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
"use strict" | ||
|
||
module.exports = { | ||
extends: "stylelint-config-recommended-vue", | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
tests/fixtures/integrations/stylelint-config-standard-scss/src/valid.vue
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
<style lang="scss"> | ||
a { | ||
color: red; | ||
color: v-bind(color); | ||
} | ||
// SCSS | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
package-lock=false |
16 changes: 16 additions & 0 deletions
16
tests/fixtures/integrations/stylelint-scss-v4.1/package.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
{ | ||
"name": "stylelint-config-recommended-vue-test-stylelint", | ||
"private": true, | ||
"version": "1.0.0", | ||
"description": "", | ||
"devDependencies": { | ||
"postcss-html": "^1.0.0", | ||
"stylelint": "^14.0.0", | ||
"stylelint-config-recommended-scss": "^5.0.2", | ||
"stylelint-config-recommended-vue": "file:../../../../stylelint-config-recommended-vue-test.tgz", | ||
"stylelint-scss": "4.1.0" | ||
}, | ||
"engines": { | ||
"node": "^12 || >=14" | ||
} | ||
} |
7 changes: 7 additions & 0 deletions
7
tests/fixtures/integrations/stylelint-scss-v4.1/src/invalid.vue
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
<style lang="scss"> | ||
a { | ||
@if $x == null { | ||
color: red; | ||
} | ||
} | ||
</style> |
32 changes: 32 additions & 0 deletions
32
tests/fixtures/integrations/stylelint-scss-v4.1/src/valid.vue
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
<style lang="scss"> | ||
a { | ||
color: v-bind(color); | ||
padding-right: math.div(4, 2); | ||
} | ||
// SCSS | ||
.b { | ||
// stylelint-disable-next-line scss/at-if-no-null | ||
@if $x == null { | ||
color: red; | ||
} | ||
} | ||
@mixin my-mixin { | ||
color: blue | ||
} | ||
.c { | ||
@include my-mixin | ||
} | ||
// Vue | ||
:global(.foo), | ||
::v-deep(.foo), | ||
::v-slotted(.foo), | ||
::v-global(.foo), | ||
:deep(.foo), | ||
:slotted(.foo) { | ||
color: red; | ||
} | ||
</style> |
5 changes: 5 additions & 0 deletions
5
tests/fixtures/integrations/stylelint-scss-v4.1/stylelint.config.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
"use strict" | ||
|
||
module.exports = { | ||
extends: "stylelint-config-recommended-vue/scss", | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,7 @@ | ||
<style lang="scss"> | ||
a { | ||
color: red; | ||
color: v-bind(color); | ||
padding-right: math.div(4, 2); | ||
} | ||
// SCSS | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
<style> | ||
a { | ||
color: red; | ||
color: v-bind(color); | ||
} | ||
:global(.foo), | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
<style> | ||
a { | ||
color: red; | ||
color: v-bind(color); | ||
} | ||
:global(.foo), | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
<style> | ||
a { | ||
color: red; | ||
color: v-bind(color); | ||
} | ||
:global(.foo), | ||
|
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.