diff --git a/.editorconfig b/.editorconfig new file mode 100644 index 0000000..c835e54 --- /dev/null +++ b/.editorconfig @@ -0,0 +1,16 @@ +# http://editorconfig.org +root = true + +[*] +charset = utf-8 +indent_size = 2 +indent_style = space +insert_final_newline = true +trim_trailing_whitespace = true + +[*.php] +indent_size = 4 + +[*.md] +indent_size = 4 +trim_trailing_whitespace = false diff --git a/.eslintrc b/.eslintrc new file mode 100644 index 0000000..e3578aa --- /dev/null +++ b/.eslintrc @@ -0,0 +1,3 @@ +{ + "extends": "standard" +} diff --git a/.travis.yml b/.travis.yml new file mode 100644 index 0000000..1926ca0 --- /dev/null +++ b/.travis.yml @@ -0,0 +1,10 @@ +language: node_js +node_js: +- '6' +cache: + yarn: true +script: +- yarn run lint +notifications: + slack: + secure: np7HDSwnl/LPafSpmurP1WMwC7fVeOkUkhf921zY08ICRlt1LkLhzHaus7aqEEwQiTwBXXRVTYmaWkIakFrEarEFGKly9vfpsWAibTfeRTZycXJcr7GPdgr3M3HmzaEGSGc4C/CsRJ/Swvq29MFUa0xTf1lZ+gBnMARoqDs5ODF321SLqfwge7k3G58P7ITK5OQ8QftEyXzSZ/Ar2Xb3oMlZZMKTbv9EREYO2ONFdG6KT6HiygZ2Ah9Dp34HbnmXA6nikbJWOWwPZvAfSf6hCtemSxAlicSWlcndN275VeM2Q+qCtIfFnRHUth1plR72x3d5N0O7E9RQp2J2RmceUMaH6NzK7oRZQZAirYZjvl6dw/BkprjnkLmk3cBVx0SuFK/DkWUwPwaNNoRzX3iFnrmFkRCw4LND5mBWC6Pmfb3Y/qtOC25kdIpzjVQG50yXNrXd9GMS1aSsyOHIlccBtB8/L7jzYGGi5hJTOeC7NVl/KIxk291s/XVHc+ZNsdNgMNvSNXJDxEph9Tt4xwtETla7ETejtgnwRzBedD1UeID0S7+PeU22Pt0jdb1YI5G7SVLllm8ZgnlcajlcUZTZ+mr/8S8L9wzt3NFOca3prWiORIR9EAFoWhqIhIxJFzaDyt0Xew8BsOEfP5SUxH6UkTBiSWnhhouhatHDzLC6p5c= diff --git a/lib/linter.js b/lib/linter.js index 77480b4..31fff6d 100644 --- a/lib/linter.js +++ b/lib/linter.js @@ -1,7 +1,7 @@ const walk = require('walk') const fs = require('fs') const path = require('path') -const htmlparser = require('htmlparser') +const htmlparser = require('htmlparser2') const cheerio = require('cheerio') const sassLint = require('sass-lint') const Reporter = require('./reporter.js') diff --git a/license.md b/license.md new file mode 100644 index 0000000..44dc928 --- /dev/null +++ b/license.md @@ -0,0 +1,21 @@ +# MIT License + +Copyright (c) 2017 Sourceboat + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/package.json b/package.json index 75b78c5..484416b 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "sass-lint-vue", - "version": "0.2.0", + "version": "0.2.1", "description": "Command line tool to lint Sass styles in Vue single file components.", "keywords": [ "lint", @@ -25,11 +25,20 @@ "bin": { "sass-lint-vue": "./bin/sass-lint-vue" }, + "scripts": { + "lint": "eslint --ext .js lib", + "precommit": "npm run lint" + }, "dependencies": { "chalk": "^1.1.3", "cheerio": "^0.22.0", "commander": "^2.9.0", - "htmlparser": "^1.7.7", + "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", + "husky": "^0.13.1", "sass-lint": "^1.10.2", "text-table": "^0.2.0", "walk": "^2.3.9" diff --git a/readme.md b/readme.md index 42b3da3..65fdf20 100644 --- a/readme.md +++ b/readme.md @@ -1,3 +1,33 @@ # sass-lint-vue -WIP +[![npm](https://img.shields.io/npm/v/sass-lint-vue.svg?style=flat-square)](https://www.npmjs.com/package/sass-lint-vue) +[![npm downloads](https://img.shields.io/npm/dt/sass-lint-vue.svg?style=flat-square)](https://www.npmjs.com/package/sass-lint-vue) +[![Build Status](https://img.shields.io/travis/sourceboat/sass-lint-vue.svg?style=flat-square)](https://travis-ci.org/sourceboat/sass-lint-vue) +[![js-standard-style](https://img.shields.io/badge/code%20style-standard-brightgreen.svg?style=flat-square)](http://standardjs.com/) + +Command line tool to lint [Sass](https://github.com/sass/sass) styles in [Vue single file components](https://vuejs.org/v2/guide/single-file-components.html). It uses [sass-lint](https://github.com/sasstools/sass-lint) under the hood. + +## Installation + +``` +$ npm install sass-lint-vue +``` + +## Usage + +``` +$ sass-lint-vue [options] +``` + +### Options + +* `-h, --help`: output usage information +* `-V, --version`: output the version number + +## Example + +The following example scans the `assets` directory for `.vue` files and outputs lint errors in `