Skip to content

Commit

Permalink
Merge 05abe66 into 4e65b25
Browse files Browse the repository at this point in the history
  • Loading branch information
ota-meshi committed Jul 22, 2020
2 parents 4e65b25 + 05abe66 commit 1fb64ca
Show file tree
Hide file tree
Showing 92 changed files with 3,813 additions and 2,102 deletions.
64 changes: 64 additions & 0 deletions .github/workflows/NodeCI.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
name: CI

on:
push:
branches: [master]
pull_request:
branches: [master]

jobs:
lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
- uses: actions/setup-node@v1
with:
node-version: 14
- name: Install Packages
run: npm install
- name: Lint
run: npm run lint
test:
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [10.13.x, 12.x, 13.x, 14.x]
steps:
- uses: actions/checkout@v1
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v1
with:
node-version: ${{ matrix.node-version }}
- name: Install Packages
run: npm install
- name: build
run: npm run build
- name: Test
run: npm test
test-with-eslint6:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
- uses: actions/setup-node@v1
with:
node-version: 8.10.x
- name: Install Target Packages
run: |+
npm i -D eslint@6.0.0
npx rimraf node_modules
npm install
- name: Test
run: npm test
test-and-coverage:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
- uses: actions/setup-node@v1
- name: Install Packages
run: npm install
- name: Test
run: npm run test:nyc
- name: Coveralls GitHub Action
uses: coverallsapp/github-action@v1.1.1
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
28 changes: 28 additions & 0 deletions .github/workflows/NpmPublish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
name: publish
on:
push:
tags:
- "*"
jobs:
release:
name: check version, and release
runs-on: ubuntu-latest
steps:
- name: checkout
uses: actions/checkout@v1
- name: setup Node
uses: actions/setup-node@v1
with:
registry-url: 'https://registry.npmjs.org'
- name: Install Packages
run: npm install
- name: test
run: npm run test
- name: check can npm-publish
run: npx can-npm-publish
- name: build
run: npm run build
- name: release
run: npm publish
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
19 changes: 18 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
[![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/future-architect/eslint-plugin-vue-scoped-css.svg?branch=master)](https://travis-ci.com/future-architect/eslint-plugin-vue-scoped-css)
[![Build Status](https://github.com/future-architect/eslint-plugin-vue-scoped-css/workflows/CI/badge.svg?branch=master)](https://github.com/future-architect/eslint-plugin-vue-scoped-css/actions?query=workflow%3ACI)
[![Coverage Status](https://coveralls.io/repos/github/future-architect/eslint-plugin-vue-scoped-css/badge.svg?branch=master)](https://coveralls.io/github/future-architect/eslint-plugin-vue-scoped-css?branch=master)
<!--
[![Greenkeeper badge](https://badges.greenkeeper.io/future-architect/eslint-plugin-vue-scoped-css.svg)](https://greenkeeper.io/)
Expand Down Expand Up @@ -103,6 +103,23 @@ Enforce all the rules in this category with:
| [vue-scoped-css/no-unused-selector](https://future-architect.github.io/eslint-plugin-vue-scoped-css/rules/no-unused-selector.html) | Reports selectors defined in Scoped CSS not used in `<template>`. | |
| [vue-scoped-css/require-scoped](https://future-architect.github.io/eslint-plugin-vue-scoped-css/rules/require-scoped.html) | Enforce the `<style>` tags to has the `scoped` attribute. | |

## Recommended for Vue.js 3.x

Enforce all the rules in this category with:

```json
{
"extends": "plugin:vue-scoped-css/vue3-recommended"
}
```

| Rule ID | Description | |
|:--------|:------------|:---|
| [vue-scoped-css/no-parsing-error](https://future-architect.github.io/eslint-plugin-vue-scoped-css/rules/no-parsing-error.html) | Disallow parsing errors in `<style>` | |
| [vue-scoped-css/no-unused-keyframes](https://future-architect.github.io/eslint-plugin-vue-scoped-css/rules/no-unused-keyframes.html) | Reports the `@keyframes` is not used in Scoped CSS. | |
| [vue-scoped-css/no-unused-selector](https://future-architect.github.io/eslint-plugin-vue-scoped-css/rules/no-unused-selector.html) | Reports selectors defined in Scoped CSS not used in `<template>`. | |
| [vue-scoped-css/require-scoped](https://future-architect.github.io/eslint-plugin-vue-scoped-css/rules/require-scoped.html) | Enforce the `<style>` tags to has the `scoped` attribute. | |

## Uncategorized

No preset enables the rules in this category.
Expand Down
4 changes: 2 additions & 2 deletions docs/.vuepress/categories.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,12 +27,12 @@ for (const categoryId of Object.keys(categoryRules)) {
}
}

module.exports = categoryIds.map(categoryId => ({
module.exports = categoryIds.map((categoryId) => ({
categoryId,
title: categoryTitles[categoryId],
configDescription: categoryConfigDescriptions[categoryId],
rules: (categoryRules[categoryId] || []).filter(
rule => !rule.meta.deprecated
(rule) => !rule.meta.deprecated
),
}))
// .filter(category => category.rules.length >= 1)
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ export default {
const vm = this
const verifyAndFix = linter.verifyAndFix.bind(linter)
linter.verifyAndFix = function(...args) {
linter.verifyAndFix = function (...args) {
args[2].preprocess = vm.preprocess
args[2].postprocess = vm.postprocess
return verifyAndFix(...args)
Expand Down
10 changes: 5 additions & 5 deletions docs/.vuepress/components/components/RulesSettings.vue
Original file line number Diff line number Diff line change
Expand Up @@ -11,18 +11,18 @@
<label class="category-title">
<input
:checked="
category.rules.every(rule =>
category.rules.every((rule) =>
isErrorState(rule.ruleId)
)
"
type="checkbox"
:indeterminate.prop="
!category.rules.every(rule =>
!category.rules.every((rule) =>
isErrorState(rule.ruleId)
) &&
!category.rules.every(
rule => !isErrorState(rule.ruleId)
)
!category.rules.every(
(rule) => !isErrorState(rule.ruleId)
)
"
@input="onAllClick(category, $event)"
/>
Expand Down
6 changes: 3 additions & 3 deletions docs/.vuepress/components/components/SnsBar.vue
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ function setup() {
clearTimeout(timeoutId)
}
timeoutId = setTimeout(() => {
;(function(d, s, id) {
;(function (d, s, id) {
const [fjs] = d.getElementsByTagName(s)
if (d.getElementById(id)) {
return
Expand All @@ -54,7 +54,7 @@ function setup() {
js.src = "https://buttons.github.io/buttons.js"
fjs.parentNode.insertBefore(js, fjs)
})(document, "script", "gh-buttons")
;(function(d, s, id) {
;(function (d, s, id) {
const [fjs] = d.getElementsByTagName(s)
if (d.getElementById(id)) {
return
Expand All @@ -65,7 +65,7 @@ function setup() {
"https://connect.facebook.net/ja_JP/sdk.js#xfbml=1&version=v2.10"
fjs.parentNode.insertBefore(js, fjs)
})(document, "script", "facebook-jssdk")
;(function(d, s, id) {
;(function (d, s, id) {
const [fjs] = d.getElementsByTagName(s)
const p = /^http:/u.test(d.location) ? "http" : "https"
if (!d.getElementById(id)) {
Expand Down
3 changes: 2 additions & 1 deletion docs/.vuepress/components/eslint-code-block.vue
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,8 @@ export default {
}
return nodes
.map(
node => node.text || this.computeCodeFromSlot(node.children)
(node) =>
node.text || this.computeCodeFromSlot(node.children)
)
.join("")
},
Expand Down
16 changes: 8 additions & 8 deletions docs/.vuepress/components/playground-block.vue
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,12 @@
v-for="(msg, i) in messages"
:key="
msg.line +
':' +
msg.column +
':' +
msg.ruleId +
'@' +
i
':' +
msg.column +
':' +
msg.ruleId +
'@' +
i
"
class="message"
>
Expand Down Expand Up @@ -135,8 +135,8 @@ export default {
}
function equalsRules(a, b) {
const akeys = Object.keys(a).filter(k => a[k] !== "off")
const bkeys = Object.keys(b).filter(k => b[k] !== "off")
const akeys = Object.keys(a).filter((k) => a[k] !== "off")
const bkeys = Object.keys(b).filter((k) => b[k] !== "off")
if (akeys.length !== bkeys.length) {
return false
}
Expand Down
2 changes: 1 addition & 1 deletion docs/.vuepress/components/rules/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ export const categories = []

for (const rule of allRules) {
const title = CATEGORY_TITLES[rule.category] || rule.fallbackTitle
let category = categories.find(c => c.title === title)
let category = categories.find((c) => c.title === title)
if (!category) {
category = {
classes: CATEGORY_CLASSES[rule.category],
Expand Down
6 changes: 3 additions & 3 deletions docs/.vuepress/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@ const categories = require("./categories")
const webpack = require("webpack")

const uncategorizedRules = rules.filter(
rule => !rule.meta.docs.category && !rule.meta.deprecated
(rule) => !rule.meta.docs.category && !rule.meta.deprecated
)
const deprecatedRules = rules.filter(rule => rule.meta.deprecated)
const deprecatedRules = rules.filter((rule) => rule.meta.deprecated)

const extraCategories = []
if (uncategorizedRules.length > 0) {
Expand Down Expand Up @@ -99,7 +99,7 @@ module.exports = {
}) => [`/rules/${ruleName}`, ruleId]
),
}))
.filter(menu => Boolean(menu.children.length)),
.filter((menu) => Boolean(menu.children.length)),

// Rules in no category.
...extraCategories,
Expand Down
2 changes: 1 addition & 1 deletion docs/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
[![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/future-architect/eslint-plugin-vue-scoped-css.svg?branch=master)](https://travis-ci.com/future-architect/eslint-plugin-vue-scoped-css)
[![Build Status](https://github.com/future-architect/eslint-plugin-vue-scoped-css/workflows/CI/badge.svg?branch=master)](https://github.com/future-architect/eslint-plugin-vue-scoped-css/actions?query=workflow%3ACI)
[![Coverage Status](https://coveralls.io/repos/github/future-architect/eslint-plugin-vue-scoped-css/badge.svg?branch=master)](https://coveralls.io/github/future-architect/eslint-plugin-vue-scoped-css?branch=master)
<!--
[![Greenkeeper badge](https://badges.greenkeeper.io/future-architect/eslint-plugin-vue-scoped-css.svg)](https://greenkeeper.io/)
Expand Down
17 changes: 17 additions & 0 deletions docs/rules/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,23 @@ Enforce all the rules in this category with:
| [vue-scoped-css/no-unused-selector](./no-unused-selector.md) | Reports selectors defined in Scoped CSS not used in `<template>`. | |
| [vue-scoped-css/require-scoped](./require-scoped.md) | Enforce the `<style>` tags to has the `scoped` attribute. | |

## Recommended for Vue.js 3.x

Enforce all the rules in this category with:

```json
{
"extends": "plugin:vue-scoped-css/vue3-recommended"
}
```

| Rule ID | Description | |
|:--------|:------------|:---|
| [vue-scoped-css/no-parsing-error](./no-parsing-error.md) | Disallow parsing errors in `<style>` | |
| [vue-scoped-css/no-unused-keyframes](./no-unused-keyframes.md) | Reports the `@keyframes` is not used in Scoped CSS. | |
| [vue-scoped-css/no-unused-selector](./no-unused-selector.md) | Reports selectors defined in Scoped CSS not used in `<template>`. | |
| [vue-scoped-css/require-scoped](./require-scoped.md) | Enforce the `<style>` tags to has the `scoped` attribute. | |

## Uncategorized

No preset enables the rules in this category.
Expand Down
2 changes: 1 addition & 1 deletion docs/rules/no-parsing-error.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ description: "Disallow parsing errors in `<style>`"

> Disallow parsing errors in `<style>`
- :gear: This rule is included in `"plugin:vue-scoped-css/recommended"` and `"plugin:vue-scoped-css/all"`.
- :gear: This rule is included in all of `"plugin:vue-scoped-css/recommended"`, `"plugin:vue-scoped-css/vue3-recommended"` and `"plugin:vue-scoped-css/all"`.

This rule reports syntax errors in `<style>`.

Expand Down
2 changes: 1 addition & 1 deletion docs/rules/no-unused-keyframes.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ description: "Reports the `@keyframes` is not used in Scoped CSS."

> Reports the `@keyframes` is not used in Scoped CSS.
- :gear: This rule is included in `"plugin:vue-scoped-css/recommended"` and `"plugin:vue-scoped-css/all"`.
- :gear: This rule is included in all of `"plugin:vue-scoped-css/recommended"`, `"plugin:vue-scoped-css/vue3-recommended"` and `"plugin:vue-scoped-css/all"`.

This rule reports `@keyframes` is not used in Scoped CSS.

Expand Down
2 changes: 1 addition & 1 deletion docs/rules/no-unused-selector.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ description: "Reports selectors defined in Scoped CSS not used in `<template>`."

> Reports selectors defined in Scoped CSS not used in `<template>`.
- :gear: This rule is included in `"plugin:vue-scoped-css/recommended"` and `"plugin:vue-scoped-css/all"`.
- :gear: This rule is included in all of `"plugin:vue-scoped-css/recommended"`, `"plugin:vue-scoped-css/vue3-recommended"` and `"plugin:vue-scoped-css/all"`.

## :book: Rule Details

Expand Down
2 changes: 1 addition & 1 deletion docs/rules/require-scoped.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ description: "Enforce the `<style>` tags to has the `scoped` attribute."

> Enforce the `<style>` tags to has the `scoped` attribute.
- :gear: This rule is included in `"plugin:vue-scoped-css/recommended"` and `"plugin:vue-scoped-css/all"`.
- :gear: This rule is included in all of `"plugin:vue-scoped-css/recommended"`, `"plugin:vue-scoped-css/vue3-recommended"` and `"plugin:vue-scoped-css/all"`.

## :book: Rule Details

Expand Down
6 changes: 6 additions & 0 deletions lib/configs/vue3-recommended.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
import { collectRules } from "../utils/rules"

export = {
extends: require.resolve("./base"),
rules: collectRules("vue3-recommended"),
}
3 changes: 2 additions & 1 deletion lib/index.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
import { rules as ruleList } from "./utils/rules"
import { Rule } from "./types"
import type { Rule } from "./types"

const configs = {
base: require("./configs/base"),
recommended: require("./configs/recommended"),
"vue3-recommended": require("./configs/vue3-recommended"),
all: require("./configs/all"),
}

Expand Down
2 changes: 1 addition & 1 deletion lib/options.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ export namespace ParsedQueryOptions {
return {
ignoreBEMModifier: ignoreBEMModifier ?? false,
captureClassesFromDoc:
captureClassesFromDoc?.map(s => toRegExp(s, "g")) ?? [],
captureClassesFromDoc?.map((s) => toRegExp(s, "g")) ?? [],
}
}
}
10 changes: 7 additions & 3 deletions lib/rules/no-parsing-error.ts
Original file line number Diff line number Diff line change
@@ -1,16 +1,20 @@
import { RuleContext } from "../types"
import { VCSSParsingError } from "../styles/ast"
import type { RuleContext, Rule } from "../types"
import type { VCSSParsingError } from "../styles/ast"
import {
getStyleContexts,
getCommentDirectivesReporter,
InvalidStyleContext,
} from "../styles/context"

declare const module: {
exports: Rule
}

module.exports = {
meta: {
docs: {
description: "Disallow parsing errors in `<style>`",
category: "recommended",
categories: ["recommended", "vue3-recommended"],
default: "warn",
url:
"https://future-architect.github.io/eslint-plugin-vue-scoped-css/rules/no-parsing-error.html",
Expand Down

0 comments on commit 1fb64ca

Please sign in to comment.