From 786289e62843e957b78a8037b4c28ce5a3c0fef9 Mon Sep 17 00:00:00 2001 From: Toru Nagashima Date: Wed, 25 Jul 2018 16:39:13 +0900 Subject: [PATCH 01/99] Docs: add vuepress documentation --- .eslintignore | 3 + .vscode/settings.json | 7 +- README.md | 288 +----------------- .../components/eslint-code-block.vue | 114 +++++++ docs/.vuepress/config.js | 45 +++ docs/README.md | 13 + docs/developer-guide/README.md | 48 +++ docs/rules/README.md | 116 +++++++ docs/rules/attribute-hyphenation.md | 83 ++--- docs/user-guide/README.md | 179 +++++++++++ package.json | 9 +- ...e-readme.js => update-docs-rules-index.js} | 39 ++- 12 files changed, 604 insertions(+), 340 deletions(-) create mode 100644 docs/.vuepress/components/eslint-code-block.vue create mode 100644 docs/.vuepress/config.js create mode 100644 docs/README.md create mode 100644 docs/developer-guide/README.md create mode 100644 docs/rules/README.md create mode 100644 docs/user-guide/README.md rename tools/{update-readme.js => update-docs-rules-index.js} (71%) diff --git a/.eslintignore b/.eslintignore index 9efb24842..20f3203c8 100644 --- a/.eslintignore +++ b/.eslintignore @@ -3,3 +3,6 @@ /node_modules /tests/fixtures /tests/integrations/*/node_modules + +!.vuepress +/docs/.vuepress/dist diff --git a/.vscode/settings.json b/.vscode/settings.json index 6287f25a9..7bd96f8d9 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -2,5 +2,10 @@ "editor.tabSize": 2, "eslint.options": { "rulePaths": ["eslint-internal-rules"] - } + }, + "eslint.validate": [ + "javascript", + "javascriptreact", + { "language": "vue", "autoFix": true } + ] } diff --git a/README.md b/README.md index f0798eb06..47b8cdd90 100644 --- a/README.md +++ b/README.md @@ -6,275 +6,21 @@ > Official ESLint plugin for Vue.js -## :exclamation: Attention - this is documentation for version `5.x` :exclamation: +## :book: Documentation -This branch contains `eslint-plugin-vue@next` which is a pre-released `5.0`, but it's not the default version that you get with `npm install eslint-plugin-vue`. In order to install this you need to specify either `"eslint-plugin-vue": "next"` in `package.json` or do `npm install eslint-plugin-vue@next`. +See https://vuejs.github.io/eslint-plugin-vue/ -Please try it and report any issues that you might have encountered. +> :exclamation: Attention - this is documentation for version `5.x` :exclamation: +> +> This branch contains `eslint-plugin-vue@next` which is a pre-released `5.0`, but it's not the default version that you get with `npm install eslint-plugin-vue`. In order to install this you need to specify either `"eslint-plugin-vue": "next"` in `package.json` or do `npm install eslint-plugin-vue@next`. +> +> Please try it and report any issues that you might have encountered. +> +> If you want to check previous releases [go here](https://github.com/vuejs/eslint-plugin-vue/releases). -If you want to check previous releases [go here](https://github.com/vuejs/eslint-plugin-vue/releases). +## :anchor: Versioning Policy -## :art: Playground on the Web - -You can try this plugin on the Web. - -- https://mysticatea.github.io/vue-eslint-demo/ - -## :grey_exclamation: Requirements - -- [ESLint](http://eslint.org/) `^5.0.0`. -- Node.js `>=6.5.0` - -## :cd: Installation - -```bash -npm install --save-dev eslint eslint-plugin-vue@next -``` - -## :rocket: Usage - -Create `.eslintrc.*` file to configure rules. See also: [http://eslint.org/docs/user-guide/configuring](http://eslint.org/docs/user-guide/configuring). - -Example **.eslintrc.js**: - -```js -module.exports = { - extends: [ - // add more generic rulesets here, such as: - // 'eslint:recommended', - 'plugin:vue/essential' - ], - rules: { - // override/add rules settings here, such as: - // 'vue/no-unused-vars': 'error' - } -} -``` - -### Single File Components - -ESLint only targets `.js` files by default. You must include the `.vue` extension using [the `--ext` option](https://eslint.org/docs/user-guide/configuring#specifying-file-extensions-to-lint) or a glob pattern. - -Examples: - -```bash -eslint --ext .js,.vue src -eslint src/**/*.{js,vue} -``` - -### Attention - -All component-related rules are being applied to code that passes any of the following checks: - -* `Vue.component()` expression -* `Vue.extend()` expression -* `Vue.mixin()` expression -* `export default {}` in `.vue` or `.jsx` file - -If you however want to take advantage of our rules in any of your custom objects that are Vue components, you might need to use special comment `// @vue/component` that marks object in the next line as a Vue component in any file, e.g.: - -```js -// @vue/component -const CustomComponent = { - name: 'custom-component', - template: '
' -} -``` -```js -Vue.component('AsyncComponent', (resolve, reject) => { - setTimeout(() => { - // @vue/component - resolve({ - name: 'async-component', - template: '
' - }) - }, 500) -}) -``` - -### `eslint-disable` functionality in `