Skip to content
This repository was archived by the owner on Oct 19, 2020. It is now read-only.

Commit d1de946

Browse files
committed
Merge branch 'release/0.4.0'
2 parents 1cab7db + 10f9907 commit d1de946

8 files changed

+1178
-346
lines changed

.travis.yml

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
language: node_js
22
node_js:
3-
- '6'
3+
- '8'
4+
- '10'
45
cache:
56
yarn: true
67
script:

Dockerfile

+13-1
Original file line numberDiff line numberDiff line change
@@ -1 +1,13 @@
1-
FROM node:8
1+
FROM node:10
2+
3+
WORKDIR /app
4+
5+
# Install dependencies
6+
COPY package.json yarn.* ./
7+
RUN yarn install
8+
9+
# Copy our code on top
10+
COPY lib ./lib
11+
COPY bin ./bin
12+
13+
ENTRYPOINT ["bin/sass-lint-vue"]

docker-compose.yml

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
version: '3'
2+
services:
3+
app:
4+
build: .
5+
volumes:
6+
- ./:/app
7+
entrypoint: tail -F /dev/null

lib/linter.js

+17-10
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ class Linter {
5454
const fileErrors = sassLint.lintText({
5555
text: template.content,
5656
filename: filePath,
57-
format: 'scss'
57+
format: template.format
5858
})
5959

6060
if (fileErrors.messages.length) {
@@ -83,16 +83,23 @@ class Linter {
8383
}
8484

8585
const $ = cheerio.load(dom)
86-
const template = $('style[lang="scss"]').text()
87-
88-
if (template.length <= 0) {
89-
return
86+
const scssTemplate = $('style[lang="scss"]').text()
87+
const sassTemplate = $('style[lang="sass"]').text()
88+
89+
if (scssTemplate.length) {
90+
templates.push({
91+
content: scssTemplate,
92+
format: 'scss',
93+
lineOffset: this.getLineOffset(scssTemplate, $.text())
94+
})
95+
}
96+
if (sassTemplate.length) {
97+
templates.push({
98+
content: sassTemplate,
99+
format: 'sass',
100+
lineOffset: this.getLineOffset(sassTemplate, $.text())
101+
})
90102
}
91-
92-
templates.push({
93-
content: template,
94-
lineOffset: this.getLineOffset(template, $.text())
95-
})
96103
})
97104

98105
var parser = new htmlparser.Parser(handler)

package.json

+8-6
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "sass-lint-vue",
3-
"version": "0.3.3",
3+
"version": "0.4.0",
44
"description": "Command line tool to lint Sass styles in Vue single file components.",
55
"keywords": [
66
"lint",
@@ -33,16 +33,18 @@
3333
"chalk": "^2.4.1",
3434
"cheerio": "^1.0.0-rc.2",
3535
"commander": "^2.18.0",
36-
"eslint": "^3.14.1",
37-
"eslint-config-standard": "^6.2.1",
38-
"eslint-plugin-promise": "^3.4.0",
39-
"eslint-plugin-standard": "^2.0.1",
4036
"htmlparser2": "^3.9.2",
4137
"sass-lint": "^1.12.1",
4238
"text-table": "^0.2.0",
4339
"walk": "^2.3.14"
4440
},
4541
"devDependencies": {
46-
"husky": "^1.0.1"
42+
"eslint": "^5.16.0",
43+
"eslint-config-standard": "^12.0.0",
44+
"eslint-plugin-import": "^2.17.3",
45+
"eslint-plugin-node": "^9.1.0",
46+
"eslint-plugin-promise": "^4.1.1",
47+
"eslint-plugin-standard": "^4.0.0",
48+
"husky": "^2.4.1"
4749
}
4850
}

readme.md

+11-4
Original file line numberDiff line numberDiff line change
@@ -39,20 +39,27 @@ sass-lint-vue assets
3939

4040
## Development
4141

42-
Build the docker container via
42+
Build the docker container via:
4343

4444
```bash
45-
docker build . -t sass-lint-vue.
45+
$ docker build . -t sass-lint-vue
4646
```
4747

4848
Lint the `Component.vue` file in the docker container via:
4949

5050
```bash
51-
docker run --rm -v (pwd):/app sass-lint-vue ./app/bin/sass-lint-vue ./app/test/Component.vue
51+
$ docker run --rm -tv $(pwd)/test:/app/test sass-lint-vue test
5252
```
5353

5454
Access the container via:
5555

5656
```bash
57-
docker run -it --rm -v (pwd):/app sass-lint-vue bash
57+
$ docker run -it --rm -v $(pwd)/test:/app/test --entrypoint bash sass-lint-vue
58+
```
59+
60+
Use docker compose to work on the files:
61+
62+
```
63+
$ docker-compose up
64+
$ docker-compose exec app bash
5865
```

test/ComponentSass.vue

+14
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
<template>
2+
<div class="wrapper"></div>
3+
</template>
4+
<script>
5+
export default {
6+
7+
}
8+
</script>
9+
<style lang="sass">
10+
.wrapper
11+
$black: #000
12+
13+
background: $black
14+
</style>

0 commit comments

Comments
 (0)