From 025fb167bbe389c647f68e924f35615a574976d8 Mon Sep 17 00:00:00 2001 From: Toru Nagashima Date: Mon, 3 Dec 2018 20:55:00 +0900 Subject: [PATCH] Docs: add vuepress documentation (#534) * Docs: add vuepress documentation * small update for rule index * add links to source code * small tweaks * upgrade vuepress * update eslint-code-block component * update attribute-hyphenation * update attributes-order * update component-name-in-template-casing * update html-closing-bracket-newline * update html-closing-bracket-spacing * update html-end-tags * update html-indent * update html-quotes * update html-self-closing * update max-attributes-per-line * add uncategorized rules to sidebar * update mustache-interpolation-spacing * update name-property-casing * update no-async-in-computed-properties * update no-confusing-v-for-v-if * update no-dupe-keys * update no-duplicate-attributes * update no-multi-spaces * update no-parsing-error * update no-reserved-keys * update no-shared-component-data * update no-side-effects-in-computed-properties * update no-template-key * update no-template-shadow * update no-textarea-mustache * update no-unused-vars * update no-use-v-if-with-v-for * update no-v-html * update order-in-components * update prop-name-casing * Add `valid-*` eslint-code-block (#622) * Update documentation - no-spaces-around-equal-signs-in-attribute - script-indent - singleline-html-element-content-newline - use-v-on-exact * Change some of blockquotes to warnings * require-prop-type-constructor * add missing Implementation blocks * comment-directive * require-render-return * jsx-uses-vars code type * require-prop-type-constructor * update - require-v-for-key - require-valid-default-prop - return-in-computed-property * add missing options * Update - v-on-style - v-bind-style * fix remaining missing options update: valid-v-on * Update require-component-is & no-use-v-if-with-v-for * Update formating from html to vue * require-default-prop * Related links -> :books: Further reading * standarize heading icons * Add processors * no-multi-spaces after merge * improve consistency across docs * this-in-template * require-prop-types * multiline-html-element-content-newline * fix json structure in return in computed property * Add Further reading for few rules * no-unused-components * Enable fixing eslint-code-block only one fixable rules * Add deprecated category This category will be present only if we have deprecated rules * Do not include cateogry in deprecated rules * Add example to return-in-computed-property * Add links and fix style * fix rebase issue no-multi-spaces * Update description of require-v-for-key * Update docs/rules/require-render-return.md * add moe notes * Improve readibility and add Further reading links * mustache-interpolation-spacing & name-property-casing move default example to rule details * Add IntelliJ IDEA / JetBrains WebStorm configuration help move editor configuration to correct section * Fix links * replace emoji with shortcodes * Add yarn install guide * Fix issue with not supported `vue/comment-directive` * unify options json (2 -> "error") 2 is used only if few examples but "error" is used in alot of them * Add bad example of no-use-v-vi-with-v-for * editor: update default formating to preset in documentation * Update vue-eslint-editor to fix tooltip issue * Add comment about auto-generated content * Fix indentations in Vue file * Add short description for vue/attribute-hyphenation rule * Add short description for vue/this-in-template rule * Update valid-template-root docs * Update user guide structure * Update rules heading in docs * Flatten sidebar navigation for rules * Update valid-template-root.md * Update README.md * Setup docs deployment * Uncomment deploy.sh * Add description metadata to rule pages & fix updating metadata when header is present * Indicate `no-parsing-error` warning as Note * Ignore gh-pages in CircleCI * Fix CircleCI config --- .circleci/config.yml | 47 ++- .eslintignore | 3 + .gitignore | 1 + .vscode/settings.json | 7 +- README.md | 317 +----------------- .../components/eslint-code-block.vue | 136 ++++++++ docs/.vuepress/config.js | 71 ++++ docs/.vuepress/style.styl | 20 ++ docs/README.md | 27 ++ docs/developer-guide/README.md | 49 +++ docs/rules/README.md | 147 ++++++++ docs/rules/attribute-hyphenation.md | 104 ++++-- docs/rules/attributes-order.md | 254 ++++++++------ docs/rules/comment-directive.md | 38 ++- .../component-name-in-template-casing.md | 83 +++-- docs/rules/html-closing-bracket-newline.md | 105 +++--- docs/rules/html-closing-bracket-spacing.md | 112 ++++--- docs/rules/html-end-tags.md | 50 +-- docs/rules/html-indent.md | 96 +++--- docs/rules/html-quotes.md | 64 ++-- docs/rules/html-self-closing.md | 76 +++-- docs/rules/jsx-uses-vars.md | 20 +- docs/rules/max-attributes-per-line.md | 163 +++++---- .../multiline-html-element-content-newline.md | 148 ++++---- docs/rules/mustache-interpolation-spacing.md | 73 ++-- docs/rules/name-property-casing.md | 77 ++++- docs/rules/no-async-in-computed-properties.md | 86 +++-- docs/rules/no-confusing-v-for-v-if.md | 70 ++-- docs/rules/no-dupe-keys.md | 65 ++-- docs/rules/no-duplicate-attributes.md | 75 +++-- docs/rules/no-multi-spaces.md | 114 ++++--- docs/rules/no-parsing-error.md | 47 ++- docs/rules/no-reserved-keys.md | 59 ++-- docs/rules/no-shared-component-data.md | 62 ++-- .../no-side-effects-in-computed-properties.md | 75 +++-- ...-spaces-around-equal-signs-in-attribute.md | 45 ++- docs/rules/no-template-key.md | 42 ++- docs/rules/no-template-shadow.md | 66 ++-- docs/rules/no-textarea-mustache.md | 41 ++- docs/rules/no-unused-components.md | 128 +++---- docs/rules/no-unused-vars.md | 36 +- docs/rules/no-use-v-if-with-v-for.md | 142 ++++---- docs/rules/no-v-html.md | 44 +-- docs/rules/order-in-components.md | 118 ++++--- docs/rules/prop-name-casing.md | 65 +++- docs/rules/require-component-is.md | 44 ++- docs/rules/require-default-prop.md | 92 ++--- docs/rules/require-prop-type-constructor.md | 61 ++-- docs/rules/require-prop-types.md | 88 ++--- docs/rules/require-render-return.md | 50 ++- docs/rules/require-v-for-key.md | 54 +-- docs/rules/require-valid-default-prop.md | 121 ++++--- docs/rules/return-in-computed-property.md | 88 +++-- docs/rules/script-indent.md | 107 +++--- ...singleline-html-element-content-newline.md | 129 ++++--- docs/rules/this-in-template.md | 96 +++--- docs/rules/use-v-on-exact.md | 42 ++- docs/rules/v-bind-style.md | 63 ++-- docs/rules/v-on-style.md | 63 ++-- docs/rules/valid-template-root.md | 105 ++---- docs/rules/valid-v-bind.md | 48 ++- docs/rules/valid-v-cloak.md | 38 ++- docs/rules/valid-v-else-if.md | 48 ++- docs/rules/valid-v-else.md | 46 ++- docs/rules/valid-v-for.md | 86 +++-- docs/rules/valid-v-html.md | 42 ++- docs/rules/valid-v-if.md | 66 ++-- docs/rules/valid-v-model.md | 65 ++-- docs/rules/valid-v-on.md | 85 +++-- docs/rules/valid-v-once.md | 38 ++- docs/rules/valid-v-pre.md | 38 ++- docs/rules/valid-v-show.md | 43 ++- docs/rules/valid-v-text.md | 43 ++- docs/user-guide/README.md | 215 ++++++++++++ lib/rules/this-in-template.js | 4 +- package.json | 10 +- tests/lib/rules/this-in-template.js | 2 +- tools/deploy.sh | 12 + ...e-readme.js => update-docs-rules-index.js} | 58 ++-- tools/update-docs.js | 131 ++++++-- tools/update.js | 2 +- 81 files changed, 3675 insertions(+), 2316 deletions(-) create mode 100644 docs/.vuepress/components/eslint-code-block.vue create mode 100644 docs/.vuepress/config.js create mode 100644 docs/.vuepress/style.styl 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 create mode 100755 tools/deploy.sh rename tools/{update-readme.js => update-docs-rules-index.js} (63%) diff --git a/.circleci/config.yml b/.circleci/config.yml index 75833b053..f1ad60e66 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -2,10 +2,28 @@ workflows: version: 2 node-multi-build: jobs: - - node-v6 - - node-v8 - - node-v10 - - node-v10-minimal + - node-v6: + filters: + branches: + ignore: gh-pages + - node-v8: + filters: + branches: + ignore: gh-pages + - node-v10: + filters: + branches: + ignore: gh-pages + - node-v10-minimal: + filters: + branches: + ignore: gh-pages + - deploy_docs: + requires: + - node-v10 + filters: + branches: + only: master version: 2 jobs: @@ -20,19 +38,16 @@ jobs: - restore_cache: keys: - v2-npm-lock-{{ .Branch }}-{{ .Environment.CIRCLE_JOB }}-{{ checksum "package.json" }} - - v2-npm-lock-master-{{ .Environment.CIRCLE_JOB }}-{{ checksum "package.json" }} - - v2-npm-cache-{{ .Branch }}-{{ .Environment.CIRCLE_JOB }} - - v2-npm-cache-master-{{ .Environment.CIRCLE_JOB }} - run: name: Install dependencies command: npm install - - run: - name: Test - command: npm test - save_cache: key: v2-npm-lock-{{ .Branch }}-{{ .Environment.CIRCLE_JOB }}-{{ checksum "package.json" }} paths: - node_modules + - run: + name: Test + command: npm test node-v6: <<: *node-base @@ -46,6 +61,7 @@ jobs: <<: *node-base docker: - image: node:10 + working_directory: ~/node_10 node-v10-minimal: steps: - run: @@ -73,4 +89,13 @@ jobs: - node_modules docker: - image: node:10 - + + deploy_docs: + docker: + - image: node:10 + steps: + - attach_workspace: + at: ~/node_10 + - run: + name: Deploy to Github Pages + command: npm run docs:deploy 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/.gitignore b/.gitignore index c07de3ba2..688618a31 100644 --- a/.gitignore +++ b/.gitignore @@ -7,3 +7,4 @@ /test.* yarn.lock yarn-error.log +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 04a8425e6..ee9d149a4 100644 --- a/README.md +++ b/README.md @@ -7,303 +7,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 `