Skip to content

Commit

Permalink
chore: release v1.4.12
Browse files Browse the repository at this point in the history
  • Loading branch information
tyankatsu0105 authored May 22, 2020
2 parents 48e7021 + a78c4b5 commit 1a63365
Show file tree
Hide file tree
Showing 86 changed files with 2,472 additions and 1,070 deletions.
4 changes: 3 additions & 1 deletion .eslintignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
node_modules/**/*
log/**/*
tools/update-readme/_readme/*
tools/update-readme/_readme/*
fixtures
lib/**/*.js
22 changes: 13 additions & 9 deletions .eslintrc.js
Original file line number Diff line number Diff line change
@@ -1,13 +1,17 @@
/** @type import('eslint').Linter.BaseConfig */
module.exports = {
root: true,
env: {
node: true,
es6: true
parserOptions: {
ecmaVersion: 2017,
project: "tsconfig.json",
},
extends: ["eslint:recommended", "plugin:node/recommended", "prettier"],
plugins: ["prettier"],
extends: ["plugin:@mysticatea/es2017", "plugin:@mysticatea/+eslint-plugin"],
rules: {
"prettier/prettier": "error",
"node/no-unpublished-require": ["warn"]
}
"@mysticatea/prettier": [
"error",
{
tabWidth: 2,
},
],
"func-style": ["error", "expression"],
},
};
48 changes: 48 additions & 0 deletions .github/workflows/check-update.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
name: Check Update

on: push

jobs:
checkDocs:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2

- uses: actions/cache@v1
id: cache
with:
path: node_modules
key: ${{ runner.os }}-npm-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.os }}-npm-
- name: Use Node.js 12
uses: actions/setup-node@v1
with:
registry-url: "https://registry.npmjs.org"
node-version: '12.x'

- name: Install dependencies
if: steps.cache.outputs.cache-hit != 'true'
run: npm ci

- name: Update Rules Docs
run: npm run update

- name: Check diff
id: check-diff
run: |
echo ::set-output name=diff-files::$(git diff --diff-filter=AM --name-only)
- name: Report
if: steps.check-diff.outputs.diff-files
uses: mshick/add-pr-comment@v1
with:
message: |
Please run `npm run update`
repo-token: ${{ secrets.GITHUB_TOKEN }}
allow-repeats: 'true'

- name: Exit
if: steps.check-diff.outputs.diff-files
run: exit 1
12 changes: 9 additions & 3 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ jobs:

strategy:
matrix:
# Test with Node.js v10 (LTS), v12 (LTS), and v14 (latest)
node-version: [10.x, 12.x, 14.x]
# Test with Node.js v10 (LTS), v12 (LTS), v13, and v14 (latest)
node-version: [10.x, 12.x, 13.x, 14.x]

steps:
- uses: actions/checkout@v2
Expand All @@ -32,4 +32,10 @@ jobs:
run: npm ci

- name: Test
run: npm run test
run: npm run test

- name: Test
run: npm run test

- name: Typecheck
run: npm run typecheck
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -130,3 +130,4 @@ typings/
.tool-versions
/development
!/development/.gitkeep
dist
3 changes: 0 additions & 3 deletions .hygen.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
module.exports = {
templates: `${__dirname}/_hygen`,
helpers: {
REPO_URL: () => "https://github.com/gridsome/eslint-plugin-gridsome"
}
};
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
## [1.4.12](https://github.com/gridsome/eslint-plugin-gridsome/compare/v1.4.11...v1.4.12) (2020-05-22)



## [1.4.11](https://github.com/gridsome/eslint-plugin-gridsome/compare/v1.4.9...v1.4.11) (2020-05-13)


Expand Down
53 changes: 21 additions & 32 deletions _hygen/generate/rule/rule.ejs.t
Original file line number Diff line number Diff line change
@@ -1,50 +1,39 @@
---
to: lib/rules/<%= name %>.js
to: lib/rules/<%= name %>.ts
---
/**
* @author <%= author %>
* @copyright <%= new Date().getFullYear() %> <%= author %>. All rights reserved.
* See LICENSE file in root directory for full license.
*/
"use strict";

import { AST } from "vue-eslint-parser";
import { createRule, defineTemplateBodyVisitor } from "../utils";

// ------------------------------------------------------------------------------
// Requirements
// ------------------------------------------------------------------------------
type Options = {};

// ------------------------------------------------------------------------------
// Settings
// ------------------------------------------------------------------------------
const defaultOptions: [Options] = [{}];

module.exports = {
type MessageIds = "<%= h.changeCase.camel(name) %>";
export = createRule<[Options], MessageIds>({
name: "<%= name %>",
meta: {
type: "",
docs: {
description: "<%= description %>",
category: "",
recommended: false,
url: "<%= h.REPO_URL() %>/blob/master/docs/rules/<%= name %>.md",
},
fixable: "",
type: "",
messages: {
<%= h.changeCase.camel(name) %>:
"",
},
schema: [],
deprecated: false,
replacedBy: []
},
create(context) {}
};
















defaultOptions,
create(context) {
return defineTemplateBodyVisitor(context, {

});
},
});
37 changes: 14 additions & 23 deletions _hygen/generate/rule/test.ejs.t
Original file line number Diff line number Diff line change
@@ -1,38 +1,29 @@
---
to: tests/lib/rules/<%= name %>.js
to: tests/lib/rules/<%= name %>.spec.ts
---
"use strict";
import { RuleTester } from "../../util";

// ------------------------------------------------------------------------------
// Requirements
// ------------------------------------------------------------------------------
var rule = require("../../../lib/rules/<%= name %>");
var RuleTester = require("eslint").RuleTester;
import rule from "../../../lib/rules/<%= name %>";

// ------------------------------------------------------------------------------
// Settings
// ------------------------------------------------------------------------------
var tester = new RuleTester({
const tester = new RuleTester({
parser: "vue-eslint-parser",
parserOptions: {
ecmaVersion: 2015
}
ecmaVersion: 2017,
},
});

// ------------------------------------------------------------------------------
// Tests
// ------------------------------------------------------------------------------
tester.run("<%= name %>", rule, {
valid: [
{
code: ``
}
``,
],
invalid: [
{
code: ``,
output: ``,
errors: [""]
}
]
errors: [
{
messageId: "<%= h.changeCase.camel(name) %>",
},
],
},
],
});
10 changes: 5 additions & 5 deletions docs/.vuepress/config.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
const { rules } = require("../../lib");
const { rules } = require("../../dist/lib");

module.exports = {
title: "eslint-plugin-gridsome",
Expand All @@ -16,11 +16,11 @@ module.exports = {
{ text: "User Guide", link: "/user-guide/" },
{ text: "Developer Guide", link: "/developer-guide/" },
{ text: "Rules", link: "/rules/" },
{ text: "Gridsome", link: "https://gridsome.org/" }
{ text: "Gridsome", link: "https://gridsome.org/" },
],
sidebar: {
"/rules/": ["/rules/", ...Object.keys(rules)],
"/": ["/introduction/", "/user-guide/", "/developer-guide/", "/rules/"]
}
}
"/": ["/introduction/", "/user-guide/", "/developer-guide/", "/rules/"],
},
},
};
12 changes: 7 additions & 5 deletions docs/rules/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,14 @@
title: Rules
---

<!-- This file has been automatically generated, in order to update it's content execute "npm run update" -->

# Rules

## 🛠Available rules

| Rule name | Description | Fixable |
| :------------------------------------------------ | :----------------------------------------------------------------------------- | :-----: |
| [format-query-block](/rules/format-query-block) | Format fix for `<page-query>` and `<static-query>` in .vue. Using Prettier API | 👌 |
| [require-g-image-src](/rules/require-g-image-src) | Require v-bind:src or src of `<g-image>` elements | |
| [require-g-link-to](/rules/require-g-link-to) | Require v-bind:to or to of `<g-link>` elements | |
| Rule ID | Description | Fixable |
| :--------------------------------------------------------- | :----------------------------------------------------------------------------- | :------: |
| [gridsome/format-query-block](/rules/format-query-block) | Format fix for `<page-query>` and `<static-query>` in .vue. Using Prettier API | :wrench: |
| [gridsome/require-g-image-src](/rules/require-g-image-src) | Require v-bind:src or src of `<g-image>` elements | |
| [gridsome/require-g-link-to](/rules/require-g-link-to) | Require v-bind:to or to of `<g-link>` elements | |
5 changes: 5 additions & 0 deletions lib/configs.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import recommended from "./configs/recommended";

export const configs = {
recommended,
};
10 changes: 10 additions & 0 deletions lib/configs/base.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
export = {
parser: "vue-eslint-parser",
parserOptions: {
sourceType: "module",
ecmaFeatures: {
jsx: true,
},
},
plugins: ["gridsome"],
};
22 changes: 0 additions & 22 deletions lib/configs/recommended.js

This file was deleted.

8 changes: 8 additions & 0 deletions lib/configs/recommended.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
export = {
extends: require.resolve("./base"),
rules: {
"gridsome/format-query-block": "warn",
"gridsome/require-g-image-src": "error",
"gridsome/require-g-link-to": "warn",
},
};
12 changes: 0 additions & 12 deletions lib/index.js

This file was deleted.

7 changes: 7 additions & 0 deletions lib/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import { rules } from "./rules";
import { configs } from "./configs";

export = {
rules,
configs,
};
10 changes: 10 additions & 0 deletions lib/rules.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
// This file has been automatically generated, in order to update it's content execute "npm run update"
import formatQueryBlock from "./rules/format-query-block";
import requireGImageSrc from "./rules/require-g-image-src";
import requireGLinkTo from "./rules/require-g-link-to";

export const rules = {
"format-query-block": formatQueryBlock,
"require-g-image-src": requireGImageSrc,
"require-g-link-to": requireGLinkTo,
};
Loading

0 comments on commit 1a63365

Please sign in to comment.