-
Notifications
You must be signed in to change notification settings - Fork 4.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Added stylelint configuration. #842
base: develop
Are you sure you want to change the base?
Changes from 20 commits
926cb92
8aded35
3bc1e6d
e4ebec9
292c84d
4bda3d6
79bf95e
51081c7
0a541d4
148be44
71ea681
c663db3
347a1a4
bfea365
1983127
8f44031
47c9129
1611f2a
fbbadf0
b414930
3b1064e
d5fd8f3
7de3a4e
5b138f3
3c15450
3cbf82a
5424ed8
43de546
47bab50
d10dfec
8593d5b
a3df122
476a8e2
e5d2c78
4532c2b
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,7 @@ | ||
# Linter Configuration | ||
|
||
This boilerplate uses [ESLint](http://eslint.org/) as the linter, and uses the [Standard](https://github.com/feross/standard/blob/master/RULES.md) preset with some small customizations. | ||
## ESLint | ||
This boilerplate uses [ESLint](http://eslint.org/) for JavaScript linting, and uses the [Standard](https://github.com/feross/standard/blob/master/RULES.md) preset with some small customizations. | ||
|
||
If you are not happy with the default linting rules, you have several options: | ||
|
||
|
@@ -14,3 +15,16 @@ If you are not happy with the default linting rules, you have several options: | |
2. Pick a different ESLint preset when generating the project, for example [eslint-config-airbnb](https://github.com/airbnb/javascript/tree/master/packages/eslint-config-airbnb). | ||
|
||
3. Pick "none" for ESLint preset when generating the project and define your own rules. See [ESLint documentation](http://eslint.org/docs/rules/) for more details. | ||
|
||
## stylelint | ||
This boilerplate uses [stylelint](http://stylint.io/) as for style linting, and uses the [Standard](https://github.com/stylelint/stylelint-config-standard) preset. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. You have a typo in the There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Thank you. |
||
|
||
If you are not happy with the default linting rules, you have several options: | ||
|
||
1. Overwrite individual rules in `.stylelintrc.js`. For example, you can add the following rule to enforce tabs. | ||
|
||
``` js | ||
"indentation": "tab", | ||
``` | ||
|
||
2. Pick "none" for stylelint preset when generating the project and define your own rules. See [Stylelint documentation](http://stylelint.io/user-guide/rules/) for more details. |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
module.exports = { | ||
{{#if_eq eslintConfig "standard"}} | ||
extends: 'stylelint-config-standard', | ||
{{/if_eq}} | ||
{{#if_eq eslintConfig "recommended"}} | ||
extends: 'stylelint-config-recommended', | ||
{{/if_eq}} | ||
{{#if_eq eslintConfig "wikimedia"}} | ||
extends: 'stylelint-config-wikimedia', | ||
{{/if_eq}} | ||
// add your custom rules here | ||
rules: { | ||
} | ||
}; |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -10,8 +10,10 @@ | |
"build": "node build/build.js"{{#unit}}, | ||
"unit": "cross-env BABEL_ENV=test karma start test/unit/karma.conf.js --single-run"{{/unit}}{{#e2e}}, | ||
"e2e": "node test/e2e/runner.js"{{/e2e}}{{#if_or unit e2e}}, | ||
"test": "{{#unit}}npm run unit{{/unit}}{{#unit}}{{#e2e}} && {{/e2e}}{{/unit}}{{#e2e}}npm run e2e{{/e2e}}"{{/if_or}}{{#lint}}, | ||
"lint": "eslint --ext .js,.vue src{{#unit}} test/unit/specs{{/unit}}{{#e2e}} test/e2e/specs{{/e2e}}"{{/lint}} | ||
"test": "{{#unit}}npm run unit{{/unit}}{{#unit}}{{#e2e}} && {{/e2e}}{{/unit}}{{#e2e}}npm run e2e{{/e2e}}"{{/if_or}}{{#eslint}}, | ||
"lint:eslint": "eslint --ext .js,.vue src{{#unit}} test/unit/specs{{/unit}}{{#e2e}} test/e2e/specs{{/e2e}}"{{/eslint}}{{#stylelint}}, | ||
"lint:stylelint": "stylelint \"**/*.{vue,htm,html,css,sss,less,scss,sass}\" --custom-syntax postcss-html"{{/stylelint}}{{#if_or eslint stylelint}}, | ||
"lint": "{{#eslint}}npm run lint:eslint{{/eslint}}{{#eslint}}{{#stylelint}} && {{/stylelint}}{{/eslint}}{{#stylelint}}npm run lint:stylelint{{/stylelint}}"{{/if_or}} | ||
}, | ||
"dependencies": { | ||
"vue": "^2.4.2"{{#router}}, | ||
|
@@ -20,9 +22,9 @@ | |
"devDependencies": { | ||
"autoprefixer": "^7.1.2", | ||
"babel-core": "^6.22.1", | ||
{{#lint}} | ||
{{#eslint}} | ||
"babel-eslint": "^7.1.1", | ||
{{/lint}} | ||
{{/eslint}} | ||
"babel-loader": "^7.1.1", | ||
"babel-plugin-transform-runtime": "^6.22.0", | ||
"babel-preset-env": "^1.3.2", | ||
|
@@ -33,22 +35,22 @@ | |
"copy-webpack-plugin": "^4.0.1", | ||
"css-loader": "^0.28.0", | ||
"cssnano": "^3.10.0", | ||
{{#lint}} | ||
{{#eslint}} | ||
"eslint": "^3.19.0", | ||
"eslint-friendly-formatter": "^3.0.0", | ||
"eslint-loader": "^1.7.1", | ||
"eslint-plugin-html": "^3.0.0", | ||
{{#if_eq lintConfig "standard"}} | ||
{{#if_eq eslintConfig "standard"}} | ||
"eslint-config-standard": "^6.2.1", | ||
"eslint-plugin-promise": "^3.4.0", | ||
"eslint-plugin-standard": "^2.0.1", | ||
{{/if_eq}} | ||
{{#if_eq lintConfig "airbnb"}} | ||
{{#if_eq eslintConfig "airbnb"}} | ||
"eslint-config-airbnb-base": "^11.1.3", | ||
"eslint-import-resolver-webpack": "^0.8.1", | ||
"eslint-plugin-import": "^2.2.0", | ||
{{/if_eq}} | ||
{{/lint}} | ||
{{/eslint}} | ||
"eventsource-polyfill": "^0.9.6", | ||
"express": "^4.14.1", | ||
"extract-text-webpack-plugin": "^2.0.0", | ||
|
@@ -76,6 +78,9 @@ | |
"babel-plugin-istanbul": "^4.1.1", | ||
"phantomjs-prebuilt": "^2.1.14", | ||
{{/unit}} | ||
{{#stylelint}} | ||
"postcss-html": "^0.9.0", | ||
{{/stylelint}} | ||
{{#e2e}} | ||
"chromedriver": "^2.27.2", | ||
"cross-spawn": "^5.0.1", | ||
|
@@ -84,6 +89,19 @@ | |
{{/e2e}} | ||
"semver": "^5.3.0", | ||
"shelljs": "^0.7.6", | ||
{{#stylelint}} | ||
"stylelint": "github:stylelint/stylelint", | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'm not sure there is a necessary to use github? it has no version control..I think. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'm waiting for the next release of stylelint that including stylelint/stylelint#2799. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. stylelint/stylelint#2838 |
||
"stylelint-webpack-plugin": "^0.9.0", | ||
{{#if_eq stylelintConfig "standard"}} | ||
"stylelint-config-standard": "^17.0.0", | ||
{{/if_eq}} | ||
{{#if_eq stylelintConfig "recommended"}} | ||
"stylelint-config-recommended": "^1.0.0", | ||
{{/if_eq}} | ||
{{#if_eq stylelintConfig "wikimedia"}} | ||
"stylelint-config-wikimedia": "^0.4.1", | ||
{{/if_eq}} | ||
{{/stylelint}} | ||
"opn": "^5.1.0", | ||
"optimize-css-assets-webpack-plugin": "^2.0.0", | ||
"ora": "^1.2.0", | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,15 @@ | ||
import Vue from 'vue'{{#if_eq lintConfig "airbnb"}};{{/if_eq}} | ||
import Router from 'vue-router'{{#if_eq lintConfig "airbnb"}};{{/if_eq}} | ||
import Hello from '@/components/Hello'{{#if_eq lintConfig "airbnb"}};{{/if_eq}} | ||
import Vue from 'vue'{{#if_eq eslintConfig "airbnb"}};{{/if_eq}} | ||
import Router from 'vue-router'{{#if_eq eslintConfig "airbnb"}};{{/if_eq}} | ||
import Hello from '@/components/Hello'{{#if_eq eslintConfig "airbnb"}};{{/if_eq}} | ||
|
||
Vue.use(Router){{#if_eq lintConfig "airbnb"}};{{/if_eq}} | ||
Vue.use(Router){{#if_eq eslintConfig "airbnb"}};{{/if_eq}} | ||
|
||
export default new Router({ | ||
routes: [ | ||
{ | ||
path: '/', | ||
name: 'Hello', | ||
component: Hello{{#if_eq lintConfig "airbnb"}},{{/if_eq}} | ||
}{{#if_eq lintConfig "airbnb"}},{{/if_eq}} | ||
]{{#if_eq lintConfig "airbnb"}},{{/if_eq}} | ||
}){{#if_eq lintConfig "airbnb"}};{{/if_eq}} | ||
component: Hello{{#if_eq eslintConfig "airbnb"}},{{/if_eq}} | ||
}{{#if_eq eslintConfig "airbnb"}},{{/if_eq}} | ||
]{{#if_eq eslintConfig "airbnb"}},{{/if_eq}} | ||
}){{#if_eq eslintConfig "airbnb"}};{{/if_eq}} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hey @gucong3000 Can you explain to me what this post hook does? I'm horrbile with bash.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Move files from ./test/**/* to here:
Then we can download them.