diff --git a/.circleci/config.yml b/.circleci/config.yml index 6e188972..5e919c85 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -7,7 +7,7 @@ defaults: &defaults environment: # Pre-install the required language file as package activation doesn't wait # for the installation to complete. - APM_TEST_PACKAGES: "language-postcss" + APM_TEST_PACKAGES: "language-postcss language-vue" steps: # Restore project state - attach_workspace: diff --git a/.travis.yml b/.travis.yml index d66d3b14..4fcec7d4 100644 --- a/.travis.yml +++ b/.travis.yml @@ -8,7 +8,7 @@ env: global: # Pre-install the required language file as package activation doesn't wait # for the installation to complete. - - APM_TEST_PACKAGES="language-postcss" + - APM_TEST_PACKAGES="language-postcss language-vue" jobs: include: diff --git a/appveyor.yml b/appveyor.yml index 8298df37..7bfced62 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -1,6 +1,6 @@ ### Project specific config ### environment: - APM_TEST_PACKAGES: language-postcss + APM_TEST_PACKAGES: language-postcss language-vue matrix: - ATOM_CHANNEL: stable diff --git a/circle.yml b/circle.yml new file mode 100644 index 00000000..166624dc --- /dev/null +++ b/circle.yml @@ -0,0 +1,14 @@ +dependencies: + override: + - curl -s -O https://raw.githubusercontent.com/atom/ci/master/build-package.sh + - chmod u+x build-package.sh + +test: + override: + - ./build-package.sh + +machine: + environment: + # Pre-install the required language file as package activation doesn't wait + # for the installation to complete. + APM_TEST_PACKAGES: "language-postcss language-vue" diff --git a/lib/index.js b/lib/index.js index 4ff75724..6d890daf 100644 --- a/lib/index.js +++ b/lib/index.js @@ -67,7 +67,8 @@ export default { 'source.less', 'source.css.less', 'source.css.postcss', - 'source.css.postcss.sugarss' + 'source.css.postcss.sugarss', + 'source.css.scss.embedded.html' ]; }, diff --git a/spec/fixtures/vue/.stylelintrc b/spec/fixtures/vue/.stylelintrc new file mode 100644 index 00000000..0eb6e7c4 --- /dev/null +++ b/spec/fixtures/vue/.stylelintrc @@ -0,0 +1,5 @@ +{ + "rules": { + "block-no-empty": true + } +} diff --git a/spec/fixtures/vue/badSCSS.vue b/spec/fixtures/vue/badSCSS.vue new file mode 100644 index 00000000..f2cd1b2e --- /dev/null +++ b/spec/fixtures/vue/badSCSS.vue @@ -0,0 +1,9 @@ + + + + + + + diff --git a/spec/fixtures/vue/goodSCSS.vue b/spec/fixtures/vue/goodSCSS.vue new file mode 100644 index 00000000..fdd7b009 --- /dev/null +++ b/spec/fixtures/vue/goodSCSS.vue @@ -0,0 +1,11 @@ + + + + + + + diff --git a/spec/linter-stylelint-spec.js b/spec/linter-stylelint-spec.js index da0145e3..ad3d6890 100644 --- a/spec/linter-stylelint-spec.js +++ b/spec/linter-stylelint-spec.js @@ -249,4 +249,30 @@ describe('The stylelint provider for Linter', () => { expect(messages.length).toBe(0); }); }); + + describe('works with Vue Single File Components', () => { + const goodVueSCSS = path.join(fixtures, 'vue', 'goodSCSS.vue'); + const badVueSCSS = path.join(fixtures, 'vue', 'badSCSS.vue'); + + beforeEach(async () => { + await atom.packages.activatePackage('language-vue'); + }); + + it('shows lint messages when found', async () => { + const editor = await atom.workspace.open(badVueSCSS); + const messages = await lint(editor); + + expect(messages[0].severity).toBe('error'); + expect(messages[0].excerpt).toBe(blockNoEmpty); + expect(messages[0].url).toBe(blockNoEmptyUrl); + expect(messages[0].location.file).toBe(badVueSCSS); + expect(messages[0].location.position).toEqual([[7, 2], [7, 4]]); + }); + + it('finds nothing wrong with a valid file', async () => { + const editor = await atom.workspace.open(goodVueSCSS); + const messages = await lint(editor); + expect(messages.length).toBe(0); + }); + }); });