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

Commit

Permalink
Merge branch 'release/0.4.0'
Browse files Browse the repository at this point in the history
  • Loading branch information
pehbehbeh committed Jun 12, 2019
2 parents 1cab7db + 10f9907 commit d1de946
Show file tree
Hide file tree
Showing 8 changed files with 1,178 additions and 346 deletions.
3 changes: 2 additions & 1 deletion .travis.yml
@@ -1,6 +1,7 @@
language: node_js
node_js:
- '6'
- '8'
- '10'
cache:
yarn: true
script:
Expand Down
14 changes: 13 additions & 1 deletion Dockerfile
@@ -1 +1,13 @@
FROM node:8
FROM node:10

WORKDIR /app

# Install dependencies
COPY package.json yarn.* ./
RUN yarn install

# Copy our code on top
COPY lib ./lib
COPY bin ./bin

ENTRYPOINT ["bin/sass-lint-vue"]
7 changes: 7 additions & 0 deletions docker-compose.yml
@@ -0,0 +1,7 @@
version: '3'
services:
app:
build: .
volumes:
- ./:/app
entrypoint: tail -F /dev/null
27 changes: 17 additions & 10 deletions lib/linter.js
Expand Up @@ -54,7 +54,7 @@ class Linter {
const fileErrors = sassLint.lintText({
text: template.content,
filename: filePath,
format: 'scss'
format: template.format
})

if (fileErrors.messages.length) {
Expand Down Expand Up @@ -83,16 +83,23 @@ class Linter {
}

const $ = cheerio.load(dom)
const template = $('style[lang="scss"]').text()

if (template.length <= 0) {
return
const scssTemplate = $('style[lang="scss"]').text()
const sassTemplate = $('style[lang="sass"]').text()

if (scssTemplate.length) {
templates.push({
content: scssTemplate,
format: 'scss',
lineOffset: this.getLineOffset(scssTemplate, $.text())
})
}
if (sassTemplate.length) {
templates.push({
content: sassTemplate,
format: 'sass',
lineOffset: this.getLineOffset(sassTemplate, $.text())
})
}

templates.push({
content: template,
lineOffset: this.getLineOffset(template, $.text())
})
})

var parser = new htmlparser.Parser(handler)
Expand Down
14 changes: 8 additions & 6 deletions package.json
@@ -1,6 +1,6 @@
{
"name": "sass-lint-vue",
"version": "0.3.3",
"version": "0.4.0",
"description": "Command line tool to lint Sass styles in Vue single file components.",
"keywords": [
"lint",
Expand Down Expand Up @@ -33,16 +33,18 @@
"chalk": "^2.4.1",
"cheerio": "^1.0.0-rc.2",
"commander": "^2.18.0",
"eslint": "^3.14.1",
"eslint-config-standard": "^6.2.1",
"eslint-plugin-promise": "^3.4.0",
"eslint-plugin-standard": "^2.0.1",
"htmlparser2": "^3.9.2",
"sass-lint": "^1.12.1",
"text-table": "^0.2.0",
"walk": "^2.3.14"
},
"devDependencies": {
"husky": "^1.0.1"
"eslint": "^5.16.0",
"eslint-config-standard": "^12.0.0",
"eslint-plugin-import": "^2.17.3",
"eslint-plugin-node": "^9.1.0",
"eslint-plugin-promise": "^4.1.1",
"eslint-plugin-standard": "^4.0.0",
"husky": "^2.4.1"
}
}
15 changes: 11 additions & 4 deletions readme.md
Expand Up @@ -39,20 +39,27 @@ sass-lint-vue assets

## Development

Build the docker container via
Build the docker container via:

```bash
docker build . -t sass-lint-vue.
$ docker build . -t sass-lint-vue
```

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

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

Access the container via:

```bash
docker run -it --rm -v (pwd):/app sass-lint-vue bash
$ docker run -it --rm -v $(pwd)/test:/app/test --entrypoint bash sass-lint-vue
```

Use docker compose to work on the files:

```
$ docker-compose up
$ docker-compose exec app bash
```
14 changes: 14 additions & 0 deletions test/ComponentSass.vue
@@ -0,0 +1,14 @@
<template>
<div class="wrapper"></div>
</template>
<script>
export default {
}
</script>
<style lang="sass">
.wrapper
$black: #000
background: $black
</style>

0 comments on commit d1de946

Please sign in to comment.