-
-
Notifications
You must be signed in to change notification settings - Fork 32
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #119 from stylelint/syntax
- Loading branch information
Showing
16 changed files
with
142 additions
and
50 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
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
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
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
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,3 @@ | ||
{ | ||
"stylelint.syntax": "sass" | ||
} |
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,54 @@ | ||
'use strict'; | ||
|
||
const path = require('path'); | ||
const pWaitFor = require('p-wait-for'); | ||
const test = require('tape'); | ||
const { extensions, workspace, window, Uri, commands } = require('vscode'); | ||
const { normalizeDiagnostic, getStylelintDiagnostics } = require('../utils'); | ||
|
||
const run = () => | ||
test('vscode-stylelint with "stylelint.syntax"', async (t) => { | ||
await commands.executeCommand('vscode.openFolder', Uri.file(__dirname)); | ||
|
||
const vscodeStylelint = extensions.getExtension('stylelint.vscode-stylelint'); | ||
|
||
// Open the './test.css' file. | ||
const cssDocument = await workspace.openTextDocument(path.resolve(__dirname, 'test.css')); | ||
|
||
await window.showTextDocument(cssDocument); | ||
|
||
// Wait for diagnostics result. | ||
await pWaitFor(() => vscodeStylelint.isActive, { timeout: 2000 }); | ||
await pWaitFor(() => getStylelintDiagnostics(cssDocument.uri).length > 0, { timeout: 5000 }); | ||
|
||
// Check the result. | ||
const diagnostics = getStylelintDiagnostics(cssDocument.uri); | ||
|
||
t.deepEqual( | ||
diagnostics.map(normalizeDiagnostic), | ||
[ | ||
{ | ||
range: { start: { line: 2, character: 2 }, end: { line: 2, character: 2 } }, | ||
message: 'Expected indentation of 4 spaces (indentation)', | ||
severity: 0, | ||
code: { | ||
value: 'indentation', | ||
target: { | ||
scheme: 'https', | ||
authority: 'stylelint.io', | ||
path: '/user-guide/rules/indentation', | ||
}, | ||
}, | ||
source: 'stylelint', | ||
}, | ||
], | ||
'should work even if "stylelint.syntax" is defined.', | ||
); | ||
|
||
t.end(); | ||
}); | ||
|
||
exports.run = (root, done) => { | ||
test.onFinish(done); | ||
run(); | ||
}; |
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 @@ | ||
'use strict'; | ||
|
||
module.exports = { | ||
rules: { | ||
indentation: [4], | ||
}, | ||
}; |
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,3 @@ | ||
/* prettier-ignore */ | ||
a | ||
color: #fff; |
Oops, something went wrong.