|
| 1 | +# eslint-plugin-vue-scoped-css |
| 2 | + |
| 3 | +[eslint-plugin-vue-scoped-css](https://www.npmjs.com/package/eslint-plugin-vue-scoped-css) is ESLint plugin for [Scoped CSS in Vue.js]. |
| 4 | + |
| 5 | +[](https://www.npmjs.com/package/eslint-plugin-vue-scoped-css) |
| 6 | +[](https://www.npmjs.com/package/eslint-plugin-vue-scoped-css) |
| 7 | +[](http://www.npmtrends.com/eslint-plugin-vue-scoped-css) |
| 8 | +[](http://www.npmtrends.com/eslint-plugin-vue-scoped-css) |
| 9 | +[](http://www.npmtrends.com/eslint-plugin-vue-scoped-css) |
| 10 | +[](http://www.npmtrends.com/eslint-plugin-vue-scoped-css) |
| 11 | +[](http://www.npmtrends.com/eslint-plugin-vue-scoped-css) |
| 12 | +<!-- |
| 13 | +[](https://travis-ci.org/ota-meshi/eslint-plugin-vue-scoped-css) |
| 14 | +[](https://coveralls.io/github/ota-meshi/eslint-plugin-vue-scoped-css?branch=master) |
| 15 | +[](https://greenkeeper.io/) |
| 16 | +--> |
| 17 | + |
| 18 | +## Features |
| 19 | + |
| 20 | +This ESLint plugin provides linting rules specific to [Scoped CSS in Vue.js]. |
| 21 | + |
| 22 | +You can check on the [Online DEMO](https://ota-meshi.github.io/eslint-plugin-vue-scoped-css/playground/). |
| 23 | + |
| 24 | +<!--DOCS_IGNORE_START--> |
| 25 | + |
| 26 | +## Documentation |
| 27 | + |
| 28 | +See [documents](https://ota-meshi.github.io/eslint-plugin-vue-scoped-css/). |
| 29 | + |
| 30 | +<!--DOCS_IGNORE_END--> |
| 31 | + |
| 32 | +## Installation |
| 33 | + |
| 34 | +```bash |
| 35 | +npm install --save-dev eslint-plugin-vue-scoped-css |
| 36 | +``` |
| 37 | + |
| 38 | +## Usage |
| 39 | + |
| 40 | +Create `.eslintrc.*` file to configure rules. See also: [http://eslint.org/docs/user-guide/configuring](http://eslint.org/docs/user-guide/configuring). |
| 41 | + |
| 42 | +Example **.eslintrc.js**: |
| 43 | + |
| 44 | +```js |
| 45 | +module.exports = { |
| 46 | + extends: [ |
| 47 | + // add more generic rulesets here, such as: |
| 48 | + // 'eslint:recommended', |
| 49 | + 'plugin:vue-scoped-css/recommended' |
| 50 | + ], |
| 51 | + rules: { |
| 52 | + // override/add rules settings here, such as: |
| 53 | + // 'vue-scoped-css/no-warning-html-comments': 'error' |
| 54 | + } |
| 55 | +} |
| 56 | +``` |
| 57 | + |
| 58 | +## Configs |
| 59 | + |
| 60 | +This plugin provides 3 predefined configs: |
| 61 | + |
| 62 | +- `plugin:vue-scoped-css/base` - Settings and rules to enable correct ESLint parsing |
| 63 | +- `plugin:vue-scoped-css/recommended` - Above, plus rules to improve code experience |
| 64 | +- `plugin:vue-scoped-css/all` - All rules of this plugin are included |
| 65 | + |
| 66 | +## Rules |
| 67 | + |
| 68 | +<!--RULES_SECTION_START--> |
| 69 | + |
| 70 | +The `--fix` option on the [command line](https://eslint.org/docs/user-guide/command-line-interface#fixing-problems) automatically fixes problems reported by rules which have a wrench :wrench: below. |
| 71 | + |
| 72 | +<!--RULES_TABLE_START--> |
| 73 | + |
| 74 | +### Base Rules (Enabling Correct ESLint Parsing) |
| 75 | + |
| 76 | +Enable this plugin using with: |
| 77 | + |
| 78 | +```json |
| 79 | +{ |
| 80 | + "extends": "plugin:vue-scoped-css/base" |
| 81 | +} |
| 82 | +``` |
| 83 | + |
| 84 | +### Recommended (Improve Development Experience) |
| 85 | + |
| 86 | +Enforce all the rules in this category with: |
| 87 | + |
| 88 | +```json |
| 89 | +{ |
| 90 | + "extends": "plugin:vue-scoped-css/recommended" |
| 91 | +} |
| 92 | +``` |
| 93 | + |
| 94 | +| | Rule ID | Description | |
| 95 | +|:---|:--------|:------------| |
| 96 | +| | [vue-scoped-css/no-unused-selector](./docs/rules/no-unused-selector.md) | Reports selectors defined in Scoped CSS not used in `<template>`. | |
| 97 | +| | [vue-scoped-css/require-scoped](./docs/rules/require-scoped.md) | Enforce the `<style>` tags to has the `scoped` attribute. | |
| 98 | + |
| 99 | +### Uncategorized |
| 100 | + |
| 101 | +| | Rule ID | Description | |
| 102 | +|:---|:--------|:------------| |
| 103 | +| | [vue-scoped-css/require-selector-used-inside](./docs/rules/require-selector-used-inside.md) | Reports the defined selectors is not used inside `<template>`. | |
| 104 | + |
| 105 | +<!--RULES_TABLE_END--> |
| 106 | +<!--RULES_SECTION_END--> |
| 107 | + |
| 108 | +## Contributing |
| 109 | + |
| 110 | +Welcome contributing! |
| 111 | + |
| 112 | +Please use GitHub's Issues/PRs. |
| 113 | + |
| 114 | +### Development Tools |
| 115 | + |
| 116 | +- `npm test` runs tests and measures coverage. |
| 117 | +- `npm run update` runs in order to update readme and recommended configuration. |
| 118 | + |
| 119 | +## License |
| 120 | + |
| 121 | +See the [LICENSE](LICENSE) file for license rights and limitations (MIT). |
| 122 | + |
| 123 | +[Scoped CSS in Vue.js]: https://vue-loader.vuejs.org/guide/scoped-css.html |
0 commit comments