From 168072b1a96cfb84e002f8e9dbbea62511732fb4 Mon Sep 17 00:00:00 2001 From: ota Date: Wed, 22 Jul 2020 00:32:16 +0900 Subject: [PATCH 1/3] Supports for Vue.js 3.x ### Breaking Changes - Drop supports ESLint 5.x - Drop supports `vue-eslint-parser` 5.x and 6.x - Move "vue-eslint-parser" to "peerDependencies" - Upgrade deps ### Enhancements - Supports for Vue.js 3.x Scoped styles - Change `vue-scoped-css/no-unused-selector` rule to support `::v-deep()`,`::v-slotted()` and `::v-global` pseudo-classes. - Change `vue-scoped-css/require-selector-used-inside` rule to support `::v-deep()`,`::v-slotted()` and `::v-global` pseudo-classes. https://github.com/vuejs/rfcs/blob/master/active-rfcs/0023-scoped-styles-changes.md --- .github/workflows/NodeCI.yml | 64 + .github/workflows/NpmPublish.yml | 28 + README.md | 19 +- docs/.vuepress/categories.js | 4 +- .../components/EslintPluginEditor.vue | 2 +- .../components/components/RulesSettings.vue | 10 +- .../components/components/SnsBar.vue | 6 +- .../components/eslint-code-block.vue | 3 +- .../.vuepress/components/playground-block.vue | 16 +- docs/.vuepress/components/rules/index.js | 2 +- docs/.vuepress/config.js | 6 +- docs/README.md | 2 +- docs/rules/README.md | 17 + docs/rules/no-parsing-error.md | 2 +- docs/rules/no-unused-keyframes.md | 2 +- docs/rules/no-unused-selector.md | 2 +- docs/rules/require-scoped.md | 2 +- lib/configs/vue3-recommended.ts | 6 + lib/index.ts | 3 +- lib/options.ts | 2 +- lib/rules/no-parsing-error.ts | 10 +- lib/rules/no-unused-keyframes.ts | 16 +- lib/rules/no-unused-selector.ts | 62 +- lib/rules/require-scoped.ts | 26 +- lib/rules/require-selector-used-inside.ts | 55 +- lib/styles/ast.ts | 93 +- lib/styles/context/comment-directive/index.ts | 8 +- lib/styles/context/index.ts | 4 +- lib/styles/context/style/index.ts | 22 +- lib/styles/context/vue-components/find-vue.ts | 10 +- lib/styles/context/vue-components/index.ts | 12 +- lib/styles/parser/css-parser.ts | 6 +- lib/styles/parser/index.ts | 4 +- lib/styles/parser/scss-parser.ts | 2 +- .../parser/selector/css-selector-parser.ts | 94 +- lib/styles/parser/selector/replace-utils.ts | 2 +- .../parser/selector/scss-selector-parser.ts | 10 +- .../parser/selector/stylus-selector-parser.ts | 10 +- lib/styles/parser/stylus-parser.ts | 2 +- lib/styles/parser/utils.ts | 2 +- .../selectors/query/attribute-tracker.ts | 2 +- lib/styles/selectors/query/elements.ts | 6 +- lib/styles/selectors/query/index.ts | 283 +- .../resolver/css-selector-resolver.ts | 47 +- .../resolver/scss-selector-resolver.ts | 2 +- .../resolver/stylus-selector-resolver.ts | 10 +- lib/styles/template/at-rule-params/css.ts | 2 +- lib/styles/template/at-rule-params/scss.ts | 2 +- lib/styles/template/at-rule-params/stylus.ts | 2 +- lib/styles/template/decl-value/css.ts | 2 +- lib/styles/template/decl-value/scss.ts | 2 +- lib/styles/template/decl-value/stylus.ts | 2 +- lib/styles/template/index.ts | 13 +- lib/styles/template/selector/css.ts | 2 +- lib/styles/template/selector/scss.ts | 2 +- lib/styles/template/selector/stylus.ts | 2 +- lib/styles/utils/index.ts | 7 - lib/styles/utils/nodes.ts | 2 +- lib/styles/utils/selectors.ts | 140 +- lib/types.ts | 44 +- lib/utils/rules.ts | 10 +- lib/utils/utils.ts | 9 +- package-lock.json | 3607 +++++++++-------- package.json | 45 +- tests/lib/rules/no-unused-selector.ts | 193 + tests/lib/rules/require-scoped.ts | 3 - .../lib/rules/require-selector-used-inside.ts | 140 + .../styles/fixtures/index/v-deep01/ast.json | 349 ++ .../index/v-deep01/selectors-text.json | 13 + .../fixtures/index/v-deep01/selectors.json | 196 + .../styles/fixtures/index/v-deep01/source.vue | 12 + .../selectors/query/deep01/query-result.json | 2 +- .../query/slot-tag01/query-result.json | 2 +- .../query/v-deep01/query-result.json | 12 + .../selectors/query/v-deep01/source.vue | 16 + .../query/v-global01/query-result.json | 20 + .../v-global01/reverse-query-result.json | 15 + .../selectors/query/v-global01/source.vue | 20 + .../query/v-slotted01/query-result.json | 11 + .../selectors/query/v-slotted01/source.vue | 16 + tests/lib/styles/parser/index.ts | 10 +- tests/lib/styles/selectors/index.ts | 6 +- tests/lib/styles/selectors/query.ts | 37 +- tests/lib/styles/test-utils.ts | 2 +- tools/lib/categories.ts | 18 +- tools/lib/load-configs.ts | 4 +- tools/new-rule.ts | 14 +- tools/render-rules.ts | 12 +- tools/update-docs.ts | 40 +- tools/update-readme.ts | 2 +- tools/update-rules.ts | 10 +- typings/eslint-utils/index.d.ts | 2 +- 92 files changed, 3893 insertions(+), 2177 deletions(-) create mode 100644 .github/workflows/NodeCI.yml create mode 100644 .github/workflows/NpmPublish.yml create mode 100644 lib/configs/vue3-recommended.ts create mode 100644 tests/lib/styles/fixtures/index/v-deep01/ast.json create mode 100644 tests/lib/styles/fixtures/index/v-deep01/selectors-text.json create mode 100644 tests/lib/styles/fixtures/index/v-deep01/selectors.json create mode 100644 tests/lib/styles/fixtures/index/v-deep01/source.vue create mode 100644 tests/lib/styles/fixtures/selectors/query/v-deep01/query-result.json create mode 100644 tests/lib/styles/fixtures/selectors/query/v-deep01/source.vue create mode 100644 tests/lib/styles/fixtures/selectors/query/v-global01/query-result.json create mode 100644 tests/lib/styles/fixtures/selectors/query/v-global01/reverse-query-result.json create mode 100644 tests/lib/styles/fixtures/selectors/query/v-global01/source.vue create mode 100644 tests/lib/styles/fixtures/selectors/query/v-slotted01/query-result.json create mode 100644 tests/lib/styles/fixtures/selectors/query/v-slotted01/source.vue diff --git a/.github/workflows/NodeCI.yml b/.github/workflows/NodeCI.yml new file mode 100644 index 00000000..91f49a9b --- /dev/null +++ b/.github/workflows/NodeCI.yml @@ -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 }} diff --git a/.github/workflows/NpmPublish.yml b/.github/workflows/NpmPublish.yml new file mode 100644 index 00000000..9ec7ae40 --- /dev/null +++ b/.github/workflows/NpmPublish.yml @@ -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 }} diff --git a/README.md b/README.md index a8c68a95..411bae15 100644 --- a/README.md +++ b/README.md @@ -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)