Skip to content
This repository was archived by the owner on Aug 7, 2023. It is now read-only.

Commit f269c79

Browse files
committed
feat: support linting in vue single-file components with scss
1 parent 12d9215 commit f269c79

File tree

9 files changed

+70
-4
lines changed

9 files changed

+70
-4
lines changed

.circleci/config.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ defaults: &defaults
77
environment:
88
# Pre-install the required language file as package activation doesn't wait
99
# for the installation to complete.
10-
APM_TEST_PACKAGES: "language-postcss"
10+
APM_TEST_PACKAGES: "language-postcss language-vue"
1111
steps:
1212
# Restore project state
1313
- attach_workspace:

.travis.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ env:
88
global:
99
# Pre-install the required language file as package activation doesn't wait
1010
# for the installation to complete.
11-
- APM_TEST_PACKAGES="language-postcss"
11+
- APM_TEST_PACKAGES="language-postcss language-vue"
1212

1313
jobs:
1414
include:

appveyor.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
### Project specific config ###
22
environment:
3-
APM_TEST_PACKAGES: language-postcss
3+
APM_TEST_PACKAGES: language-postcss language-vue
44

55
matrix:
66
- ATOM_CHANNEL: stable

circle.yml

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
dependencies:
2+
override:
3+
- curl -s -O https://raw.githubusercontent.com/atom/ci/master/build-package.sh
4+
- chmod u+x build-package.sh
5+
6+
test:
7+
override:
8+
- ./build-package.sh
9+
10+
machine:
11+
environment:
12+
# Pre-install the required language file as package activation doesn't wait
13+
# for the installation to complete.
14+
APM_TEST_PACKAGES: "language-postcss language-vue"

lib/index.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,8 @@ export default {
8989
'source.less',
9090
'source.css.less',
9191
'source.css.postcss',
92-
'source.css.postcss.sugarss'
92+
'source.css.postcss.sugarss',
93+
'source.css.scss.embedded.html'
9394
];
9495
},
9596

spec/fixtures/vue/.stylelintrc

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
{
2+
"rules": {
3+
"block-no-empty": true
4+
}
5+
}

spec/fixtures/vue/badSCSS.vue

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
<template></template>
2+
3+
4+
<script></script>
5+
6+
7+
<style lang="scss" scoped>
8+
a {}
9+
</style>

spec/fixtures/vue/goodSCSS.vue

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
<template></template>
2+
3+
4+
<script></script>
5+
6+
7+
<style lang="scss" scoped>
8+
a {
9+
color: red;
10+
}
11+
</style>

spec/linter-stylelint-spec.js

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -328,4 +328,30 @@ describe('The stylelint provider for Linter', () => {
328328
rimraf.sync(tempDir);
329329
});
330330
});
331+
332+
describe('works with Vue Single File Components', () => {
333+
const goodVueSCSS = path.join(fixtures, 'vue', 'goodSCSS.vue');
334+
const badVueSCSS = path.join(fixtures, 'vue', 'badSCSS.vue');
335+
336+
beforeEach(async () => {
337+
await atom.packages.activatePackage('language-vue');
338+
});
339+
340+
it('shows lint messages when found', async () => {
341+
const editor = await atom.workspace.open(badVueSCSS);
342+
const messages = await lint(editor);
343+
344+
expect(messages[0].severity).toBe('error');
345+
expect(messages[0].excerpt).toBe(blockNoEmpty);
346+
expect(messages[0].url).toBe(blockNoEmptyUrl);
347+
expect(messages[0].location.file).toBe(badVueSCSS);
348+
expect(messages[0].location.position).toEqual([[7, 2], [7, 4]]);
349+
});
350+
351+
it('finds nothing wrong with a valid file', async () => {
352+
const editor = await atom.workspace.open(goodVueSCSS);
353+
const messages = await lint(editor);
354+
expect(messages.length).toBe(0);
355+
});
356+
});
331357
});

0 commit comments

Comments
 (0)