Skip to content

Commit

Permalink
Merge pull request #124 from billybonks/documentation/multi-language
Browse files Browse the repository at this point in the history
[DOC] add documentation on how to enable multiple language parsing
  • Loading branch information
ngsikai authored Dec 21, 2018
2 parents 0e482e7 + aa6d15b commit 0fa7cec
Show file tree
Hide file tree
Showing 9 changed files with 1,265 additions and 7 deletions.
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,8 @@ Hash as specified by [stylelint](https://github.com/stylelint/stylelint/blob/mas

doesn't accept `files` option

All stylelint supported languages except `jsx` are valid targets by default. Alternatively, a `syntax` option can be passed in to scope targets to one language.

`onError(errors)` {function}

A hook that allows you to do whatever you want, when an error occurs
Expand Down
2 changes: 1 addition & 1 deletion index.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ const stylelint = require('stylelint');
const path = require('path');
const broccoliNodeInfo = require('broccoli-node-info');
const chalk = require('chalk');
const SUPPORTED_FILE_FORMATS = ['sss','scss','sass','css','less'];
const SUPPORTED_FILE_FORMATS = ['sss','scss','sass','css','less','html','js'];
const FACTORY_METHOD_USED = Symbol('create() factory method was used');
const concat = require('broccoli-concat');

Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@
"chalk": "~2.4.1",
"ignore": "^5.0.2",
"js-string-escape": "~1.0.1",
"stylelint": "^9.1.3"
"stylelint": "^9.5.0"
},
"jest": {
"projects": [
Expand Down
20 changes: 20 additions & 0 deletions tests/__snapshots__/test.js.snap
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,16 @@ QUnit.test('style.css should pass stylelint', function(assert) {
assert.ok(false, '1:15 Unexpected empty block (block-no-empty)\\\\n6:10 Expected \\\\\\\\\\"#000000\\\\\\\\\\" to be \\\\\\\\\\"black\\\\\\\\\\" (color-named)');
});
QUnit.test('style.html should pass stylelint', function(assert) {
assert.expect(1);
assert.ok(false, '3:19 Unexpected empty block (block-no-empty)\\\\n8:14 Expected \\\\\\\\\\"#000000\\\\\\\\\\" to be \\\\\\\\\\"black\\\\\\\\\\" (color-named)');
});
QUnit.test('style.js should pass stylelint', function(assert) {
assert.expect(1);
assert.ok(false, '5:1 Expected no more than 2 empty lines (max-empty-lines)\\\\n9:11 Unexpected unit \\\\\\\\\\"px\\\\\\\\\\" (unit-whitelist)\\\\n8:10 Expected \\\\\\\\\\"#000000\\\\\\\\\\" to be \\\\\\\\\\"black\\\\\\\\\\" (color-named)');
});
QUnit.test('style.less should pass stylelint', function(assert) {
assert.expect(1);
assert.ok(false, '1:15 Unexpected empty block (block-no-empty)\\\\n14:11 Unexpected unit \\\\\\\\\\"px\\\\\\\\\\" (unit-whitelist)\\\\n14:3 Unexpected unknown property \\\\\\\\\\"marign\\\\\\\\\\" (property-no-unknown)');
Expand Down Expand Up @@ -93,6 +103,16 @@ QUnit.test('style.css should pass stylelint', function(assert) {
assert.ok(true, 'style.css should pass stylelint');
});
QUnit.test('style.html should pass stylelint', function(assert) {
assert.expect(1);
assert.ok(true, 'style.html should pass stylelint');
});
QUnit.test('style.js should pass stylelint', function(assert) {
assert.expect(1);
assert.ok(true, 'style.js should pass stylelint');
});
QUnit.test('style.less should pass stylelint', function(assert) {
assert.expect(1);
assert.ok(true, 'style.less should pass stylelint');
Expand Down
11 changes: 11 additions & 0 deletions tests/fixtures/multi-language/error-path/style.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<html>
<style>
.should-error {

}

.color.must.be.named {
color: #000000
}
</style>
</html>
10 changes: 10 additions & 0 deletions tests/fixtures/multi-language/error-path/style.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
var styled = require('styled-components');

module.exports = styled.h1`
font-size: 1.5em;
text-align: center;
color: #000000;
margin: 20px;
`;
14 changes: 14 additions & 0 deletions tests/fixtures/multi-language/happy-path/style.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<html>
<style>
#should-be-allowed-by-sass-lint-test-config-yml {
color: green;
}

nav {
margin: 20em auto 0;
width: 786em;
height: 45em;
border-radius: 10em;
}
</style>
</html>
9 changes: 9 additions & 0 deletions tests/fixtures/multi-language/happy-path/style.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
var styled = require('styled-components');

const Title = styled.h1`
font-size: 1.5em;
text-align: center;
color: palevioletred;
`;

module.exports = Title;
Loading

0 comments on commit 0fa7cec

Please sign in to comment.