Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 8 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@
[![NPM downloads](https://img.shields.io/npm/dm/eslint-plugin-vue-scoped-css.svg)](http://www.npmtrends.com/eslint-plugin-vue-scoped-css)
[![NPM downloads](https://img.shields.io/npm/dy/eslint-plugin-vue-scoped-css.svg)](http://www.npmtrends.com/eslint-plugin-vue-scoped-css)
[![NPM downloads](https://img.shields.io/npm/dt/eslint-plugin-vue-scoped-css.svg)](http://www.npmtrends.com/eslint-plugin-vue-scoped-css)
[![Build Status](https://travis-ci.com/ota-meshi/eslint-plugin-vue-scoped-css.svg?branch=master)](https://travis-ci.com/ota-meshi/eslint-plugin-vue-scoped-css)
<!--
[![Build Status](https://travis-ci.org/ota-meshi/eslint-plugin-vue-scoped-css.svg?branch=master)](https://travis-ci.org/ota-meshi/eslint-plugin-vue-scoped-css)
[![Coverage Status](https://coveralls.io/repos/github/ota-meshi/eslint-plugin-vue-scoped-css/badge.svg?branch=master)](https://coveralls.io/github/ota-meshi/eslint-plugin-vue-scoped-css?branch=master)
[![Greenkeeper badge](https://badges.greenkeeper.io/ota-meshi/eslint-plugin-vue-scoped-css.svg)](https://greenkeeper.io/)
-->
Expand All @@ -19,6 +19,9 @@

This ESLint plugin provides linting rules specific to [Scoped CSS in Vue.js].

- Enforce best practices for Scoped CSS.
- Supports CSS and SCSS syntax.

You can check on the [Online DEMO](https://ota-meshi.github.io/eslint-plugin-vue-scoped-css/playground/).

<!--DOCS_IGNORE_START-->
Expand Down Expand Up @@ -59,8 +62,8 @@ module.exports = {

This plugin provides 3 predefined configs:

- `plugin:vue-scoped-css/base` - Settings and rules to enable correct ESLint parsing
- `plugin:vue-scoped-css/recommended` - Above, plus rules to improve code experience
- `plugin:vue-scoped-css/base` - Settings and rules to enable this plugin
- `plugin:vue-scoped-css/recommended` - Above, plus rules for better ways to help you avoid problems
- `plugin:vue-scoped-css/all` - All rules of this plugin are included

## Rules
Expand All @@ -71,7 +74,7 @@ The `--fix` option on the [command line](https://eslint.org/docs/user-guide/comm

<!--RULES_TABLE_START-->

### Base Rules (Enabling Correct ESLint Parsing)
### Base Rules (Enabling Plugin)

Enable this plugin using with:

Expand All @@ -81,7 +84,7 @@ Enable this plugin using with:
}
```

### Recommended (Improve Development Experience)
### Recommended

Enforce all the rules in this category with:

Expand Down
4 changes: 2 additions & 2 deletions docs/.vuepress/categories.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
const { rules } = require("../../dist/utils/rules")

const categoryTitles = {
base: "Base Rules (Enabling Correct ESLint Parsing)",
recommended: "Recommended (Improve Development Experience)",
base: "Base Rules (Enabling Plugin)",
recommended: "Recommended",
}

const categoryConfigDescriptions = {
Expand Down
9 changes: 6 additions & 3 deletions docs/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@
[![NPM downloads](https://img.shields.io/npm/dm/eslint-plugin-vue-scoped-css.svg)](http://www.npmtrends.com/eslint-plugin-vue-scoped-css)
[![NPM downloads](https://img.shields.io/npm/dy/eslint-plugin-vue-scoped-css.svg)](http://www.npmtrends.com/eslint-plugin-vue-scoped-css)
[![NPM downloads](https://img.shields.io/npm/dt/eslint-plugin-vue-scoped-css.svg)](http://www.npmtrends.com/eslint-plugin-vue-scoped-css)
[![Build Status](https://travis-ci.com/ota-meshi/eslint-plugin-vue-scoped-css.svg?branch=master)](https://travis-ci.com/ota-meshi/eslint-plugin-vue-scoped-css)
<!--
[![Build Status](https://travis-ci.org/ota-meshi/eslint-plugin-vue-scoped-css.svg?branch=master)](https://travis-ci.org/ota-meshi/eslint-plugin-vue-scoped-css)
[![Coverage Status](https://coveralls.io/repos/github/ota-meshi/eslint-plugin-vue-scoped-css/badge.svg?branch=master)](https://coveralls.io/github/ota-meshi/eslint-plugin-vue-scoped-css?branch=master)
[![Greenkeeper badge](https://badges.greenkeeper.io/ota-meshi/eslint-plugin-vue-scoped-css.svg)](https://greenkeeper.io/)
-->
Expand All @@ -19,6 +19,9 @@

This ESLint plugin provides linting rules specific to [Scoped CSS in Vue.js].

- Enforce best practices for Scoped CSS.
- Supports CSS and SCSS syntax.

You can check on the [Online DEMO](./playground/).

## Installation
Expand Down Expand Up @@ -51,8 +54,8 @@ module.exports = {

This plugin provides 3 predefined configs:

- `plugin:vue-scoped-css/base` - Settings and rules to enable correct ESLint parsing
- `plugin:vue-scoped-css/recommended` - Above, plus rules to improve code experience
- `plugin:vue-scoped-css/base` - Settings and rules to enable this plugin
- `plugin:vue-scoped-css/recommended` - Above, plus rules for better ways to help you avoid problems
- `plugin:vue-scoped-css/all` - All rules of this plugin are included

## Rules
Expand Down
4 changes: 2 additions & 2 deletions docs/rules/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ sidebarDepth: 0

<!-- This file is automatically generated in tools/update-docs-rules-index.js, do not change! -->

## Base Rules (Enabling Correct ESLint Parsing)
## Base Rules (Enabling Plugin)

Enable this plugin using with:

Expand All @@ -16,7 +16,7 @@ Enable this plugin using with:
}
```

## Recommended (Improve Development Experience)
## Recommended

Enforce all the rules in this category with:

Expand Down
8 changes: 7 additions & 1 deletion lib/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,14 @@ export interface VDirectiveKeyV5 extends AST.HasLocation, AST.HasParent {
type: "VDirectiveKey"
name: string
argument: string | null
modifiers: [string]
modifiers: string[]
parent: AST.VAttribute
shorthand: boolean
raw: {
name: string
argument: string | null
modifiers: string[]
}
}
export interface VDirectiveKeyV6 extends AST.HasLocation, AST.HasParent {
type: "VDirectiveKey"
Expand Down
1 change: 0 additions & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,6 @@
"mocha": "^6.2.2",
"nyc": "^14.1.1",
"pack": "^2.2.0",
"postcss-safe-parser": "^4.0.1",
"raw-loader": "^3.1.0",
"rimraf": "^3.0.0",
"ts-node": "^8.4.1",
Expand All @@ -74,6 +73,7 @@
"eslint-utils": "^1.4.3",
"lodash": "^4.17.15",
"postcss": "^7.0.21",
"postcss-safe-parser": "^4.0.1",
"postcss-scss": "^2.0.0",
"postcss-selector-parser": "^6.0.2",
"vue-eslint-parser": "^5.0.0 || ^6.0.0 || ^7.0.0"
Expand Down
4 changes: 3 additions & 1 deletion tests/lib/rules/no-parsing-error.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ const tester = new RuleTester({
tester.run("no-parsing-error", rule, {
valid: [
`
<template><!-- When using vue-eslint-parser@5, a template tag is required. --></template>
<style scoped>
.item {}
</style>
Expand All @@ -20,14 +21,15 @@ tester.run("no-parsing-error", rule, {
invalid: [
{
code: `
<template><!-- When using vue-eslint-parser@5, a template tag is required. --></template>
<style scoped>
.item {
</style>
`,
errors: [
{
message: "Parsing error: Unclosed block.",
line: 3,
line: 4,
column: 13,
},
],
Expand Down
3 changes: 3 additions & 0 deletions tests/lib/styles/parser/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,9 @@ describe("CSS Nodes Test.", () => {
if (!style.cssNode) {
throw new Error("invalid")
}
if (style.cssNode.errors.length) {
return
}
checkCSSNodeLocations(source, style.cssNode, style.lang)
})
it("should be parsed to valid AST.", () => {
Expand Down
4 changes: 2 additions & 2 deletions tools/lib/categories.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ import { rules } from "../../lib/utils/rules"
import { Rule } from "../../lib/types"

const categoryTitles = {
base: "Base Rules (Enabling Correct ESLint Parsing)",
recommended: "Recommended (Improve Development Experience)",
base: "Base Rules (Enabling Plugin)",
recommended: "Recommended",
} as { [key: string]: string }

const categoryConfigDescriptions = {
Expand Down