Skip to content

Commit 67cf6db

Browse files
committed
chore: run Prettier on codebase
1 parent 8d2f925 commit 67cf6db

16 files changed

+162
-159
lines changed

.eslintrc.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
root: true
22
extends:
3-
- plugin:@mysticatea/es2015
4-
- plugin:@mysticatea/+eslint-plugin
3+
- plugin:@mysticatea/es2015
4+
- plugin:@mysticatea/+eslint-plugin

.github/FUNDING.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
github:
2-
- mysticatea
2+
- mysticatea

.github/workflows/CI.yml

Lines changed: 42 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -1,47 +1,47 @@
11
name: CI
22
on:
3-
push:
4-
branches: [master]
5-
pull_request:
6-
branches: [master]
7-
schedule:
8-
- cron: 0 0 * * 0
3+
push:
4+
branches: [master]
5+
pull_request:
6+
branches: [master]
7+
schedule:
8+
- cron: 0 0 * * 0
99

1010
jobs:
11-
test:
12-
name: Test
13-
strategy:
14-
matrix:
15-
os: [ubuntu-latest]
16-
eslint: [6]
17-
node: [12.22.0, 12, 14.17.0, 14, 16, 18]
18-
include:
19-
# On other platforms
20-
- os: windows-latest
21-
node: 18
22-
- os: macos-latest
23-
node: 18
24-
# On the minimum supported ESLint/Node.js version
25-
- eslint: 6.6.0
26-
node: 12.22.0
11+
test:
12+
name: Test
13+
strategy:
14+
matrix:
15+
os: [ubuntu-latest]
16+
eslint: [6]
17+
node: [12.22.0, 12, 14.17.0, 14, 16, 18]
18+
include:
19+
# On other platforms
20+
- os: windows-latest
21+
node: 18
22+
- os: macos-latest
23+
node: 18
24+
# On the minimum supported ESLint/Node.js version
25+
- eslint: 6.6.0
26+
node: 12.22.0
2727

28-
runs-on: ${{ matrix.os }}
29-
steps:
30-
- name: Checkout
31-
uses: actions/checkout@v3
32-
- name: Install Node.js ${{ matrix.node }}
33-
uses: actions/setup-node@v3
34-
with:
35-
node-version: ${{ matrix.node }}
36-
- name: Install Packages
37-
run: npm install
38-
env:
39-
CI: true
40-
- name: Install ESLint@${{ matrix.eslint }}
41-
run: npm install eslint@${{ matrix.eslint }}
42-
- name: Test
43-
run: npm test
44-
- name: Send Coverage
45-
run: npm run -s codecov
46-
env:
47-
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
28+
runs-on: ${{ matrix.os }}
29+
steps:
30+
- name: Checkout
31+
uses: actions/checkout@v3
32+
- name: Install Node.js ${{ matrix.node }}
33+
uses: actions/setup-node@v3
34+
with:
35+
node-version: ${{ matrix.node }}
36+
- name: Install Packages
37+
run: npm install
38+
env:
39+
CI: true
40+
- name: Install ESLint@${{ matrix.eslint }}
41+
run: npm install eslint@${{ matrix.eslint }}
42+
- name: Test
43+
run: npm test
44+
- name: Send Coverage
45+
run: npm run -s codecov
46+
env:
47+
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}

.nycrc.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
include:
2-
- lib
2+
- lib
33
exclude:
4-
- lib/processors/vue.js
4+
- lib/processors/vue.js
55
reporter:
6-
- text-summary
7-
- lcov
6+
- text-summary
7+
- lcov

.prettierrc.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
module.exports = {
2+
tabWidth: 4,
3+
semi: false,
4+
trailingComma: "es5",
5+
}

README.md

Lines changed: 46 additions & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -16,40 +16,40 @@ npm install --save-dev eslint @mysticatea/eslint-plugin
1616

1717
### Requirements
1818

19-
- Node.js `^12.22.0 || ^14.17.0 || >=16.0.0` or newer versions.
20-
- ESLint `^6.6.0` or newer versions.
19+
- Node.js `^12.22.0 || ^14.17.0 || >=16.0.0` or newer versions.
20+
- ESLint `^6.6.0` or newer versions.
2121

2222
## 📖 Usage
2323

2424
Write in your ESLint configurations: http://eslint.org/docs/user-guide/configuring#using-the-configuration-from-a-plugin
2525

2626
### Configs
2727

28-
- `plugin:@mysticatea/es2020` ... Basic configuration for ES2020.
29-
- `plugin:@mysticatea/es2019` ... Basic configuration for ES2019.
30-
- `plugin:@mysticatea/es2018` ... Basic configuration for ES2018.
31-
- `plugin:@mysticatea/es2017` ... Basic configuration for ES2017.
32-
- `plugin:@mysticatea/es2016` ... Basic configuration for ES2016.
33-
- `plugin:@mysticatea/es2015` ... Basic configuration for ES2015.
34-
- `plugin:@mysticatea/es5` ... Basic configuration for ES5.
35-
- `plugin:@mysticatea/+modules` ... Additional configuration for ES modules.
36-
- `plugin:@mysticatea/+browser` ... Additional configuration for browser environment.
37-
- `plugin:@mysticatea/+node` ... Additional configuration for Node.js environment.
38-
- `plugin:@mysticatea/+eslint-plugin` ... Additional configuration for ESLint plugins. This includes `plugin:mysticatea/+node` setting.
28+
- `plugin:@mysticatea/es2020` ... Basic configuration for ES2020.
29+
- `plugin:@mysticatea/es2019` ... Basic configuration for ES2019.
30+
- `plugin:@mysticatea/es2018` ... Basic configuration for ES2018.
31+
- `plugin:@mysticatea/es2017` ... Basic configuration for ES2017.
32+
- `plugin:@mysticatea/es2016` ... Basic configuration for ES2016.
33+
- `plugin:@mysticatea/es2015` ... Basic configuration for ES2015.
34+
- `plugin:@mysticatea/es5` ... Basic configuration for ES5.
35+
- `plugin:@mysticatea/+modules` ... Additional configuration for ES modules.
36+
- `plugin:@mysticatea/+browser` ... Additional configuration for browser environment.
37+
- `plugin:@mysticatea/+node` ... Additional configuration for Node.js environment.
38+
- `plugin:@mysticatea/+eslint-plugin` ... Additional configuration for ESLint plugins. This includes `plugin:mysticatea/+node` setting.
3939

4040
#### Details
4141

4242
The main configurations `plugin:@mysticatea/es*` does:
4343

44-
- detect bug-like code by ESLint rules.
45-
- enforce whitespace style by Prettier.
46-
- handle the `.ts` files as TypeScript then check by `typescript-eslint-parser` and `eslint-plugin-typescript`.
47-
- handle the `.vue` files as Vue.js SFC then check by `vue-eslint-parser` and `eslint-plugin-vue`.
48-
- handle the files in `test`/`tests` directory as `mocha`'s test code.
49-
- handle the files in `scripts` directory as Node.js environment.
50-
- handle the `.eslintrc.js` file as a Node.js script.
51-
- handle the `webpack.config.js` file as a Node.js script.
52-
- handle the `rollup.config.js` file as an ES module.
44+
- detect bug-like code by ESLint rules.
45+
- enforce whitespace style by Prettier.
46+
- handle the `.ts` files as TypeScript then check by `typescript-eslint-parser` and `eslint-plugin-typescript`.
47+
- handle the `.vue` files as Vue.js SFC then check by `vue-eslint-parser` and `eslint-plugin-vue`.
48+
- handle the files in `test`/`tests` directory as `mocha`'s test code.
49+
- handle the files in `scripts` directory as Node.js environment.
50+
- handle the `.eslintrc.js` file as a Node.js script.
51+
- handle the `webpack.config.js` file as a Node.js script.
52+
- handle the `rollup.config.js` file as an ES module.
5353

5454
You can use combination of a main configuration and some additional configurations.
5555
For examples:
@@ -58,10 +58,7 @@ For examples:
5858

5959
```json
6060
{
61-
"extends": [
62-
"plugin:@mysticatea/es2015",
63-
"plugin:@mysticatea/+node"
64-
]
61+
"extends": ["plugin:@mysticatea/es2015", "plugin:@mysticatea/+node"]
6562
}
6663
```
6764

@@ -71,10 +68,7 @@ For examples:
7168

7269
```json
7370
{
74-
"extends": [
75-
"plugin:@mysticatea/es2015",
76-
"plugin:@mysticatea/+browser"
77-
]
71+
"extends": ["plugin:@mysticatea/es2015", "plugin:@mysticatea/+browser"]
7872
}
7973
```
8074

@@ -107,26 +101,26 @@ This plugin has some original rules and foreign rules.
107101

108102
#### Original rules
109103

110-
- [@mysticatea/arrow-parens](docs/rules/arrow-parens.md) enforces parens of argument lists (excludes too redundant parens) (fixable).
111-
- [@mysticatea/block-scoped-var](docs/rules/block-scoped-var.md) handles variables which are declared by `var` declaration as block-scoped. It disallows redeclarations, uses from outside of the scope, shadowing.
112-
- [@mysticatea/no-instanceof-array](docs/rules/no-instanceof-array.md) disallows 'instanceof' for Array (fixable).
113-
- [@mysticatea/no-instanceof-wrapper](docs/rules/no-instanceof-wrapper.md) disallows 'instanceof' for wrapper objects (fixable).
114-
- [@mysticatea/no-literal-call](docs/rules/no-literal-call.md) disallows a call of a literal.
115-
- [@mysticatea/no-this-in-static](docs/rules/no-this-in-static.md) disallows `this`/`super` in static methods.
116-
- [@mysticatea/no-use-ignored-vars](docs/rules/no-use-ignored-vars.md) disallows a use of ignored variables.
117-
- [@mysticatea/no-useless-rest-spread](docs/rules/no-useless-rest-spread.md) disallows unnecessary rest/spread operators (fixable).
118-
- [@mysticatea/prefer-for-of](docs/rules/prefer-for-of.md) requires `for-of` statements instead of `Array#forEach` or something like (fixable).
104+
- [@mysticatea/arrow-parens](docs/rules/arrow-parens.md) enforces parens of argument lists (excludes too redundant parens) (fixable).
105+
- [@mysticatea/block-scoped-var](docs/rules/block-scoped-var.md) handles variables which are declared by `var` declaration as block-scoped. It disallows redeclarations, uses from outside of the scope, shadowing.
106+
- [@mysticatea/no-instanceof-array](docs/rules/no-instanceof-array.md) disallows 'instanceof' for Array (fixable).
107+
- [@mysticatea/no-instanceof-wrapper](docs/rules/no-instanceof-wrapper.md) disallows 'instanceof' for wrapper objects (fixable).
108+
- [@mysticatea/no-literal-call](docs/rules/no-literal-call.md) disallows a call of a literal.
109+
- [@mysticatea/no-this-in-static](docs/rules/no-this-in-static.md) disallows `this`/`super` in static methods.
110+
- [@mysticatea/no-use-ignored-vars](docs/rules/no-use-ignored-vars.md) disallows a use of ignored variables.
111+
- [@mysticatea/no-useless-rest-spread](docs/rules/no-useless-rest-spread.md) disallows unnecessary rest/spread operators (fixable).
112+
- [@mysticatea/prefer-for-of](docs/rules/prefer-for-of.md) requires `for-of` statements instead of `Array#forEach` or something like (fixable).
119113

120114
#### Foreign rules
121115

122-
- All `@mysticatea/eslint-comments/*` rules are imported from [eslint-plugin-eslint-comments](https://www.npmjs.com/package/eslint-plugin-eslint-comments).
123-
- All `@mysticatea/eslint-plugin/*` rules are imported from [eslint-plugin-eslint-plugin](https://www.npmjs.com/package/eslint-plugin-eslint-plugin).
124-
- All `@mysticatea/node/*` rules are imported from [eslint-plugin-node](https://www.npmjs.com/package/eslint-plugin-node).
125-
- All `@mysticatea/ts/*` rules are imported from [eslint-plugin-typescript](https://www.npmjs.com/package/eslint-plugin-typescript).
126-
- All `@mysticatea/vue/*` rules are imported from [eslint-plugin-vue](https://www.npmjs.com/package/eslint-plugin-vue).
127-
- The `@mysticatea/prettier` rule is imported from [eslint-plugin-prettier](https://www.npmjs.com/package/eslint-plugin-prettier).
116+
- All `@mysticatea/eslint-comments/*` rules are imported from [eslint-plugin-eslint-comments](https://www.npmjs.com/package/eslint-plugin-eslint-comments).
117+
- All `@mysticatea/eslint-plugin/*` rules are imported from [eslint-plugin-eslint-plugin](https://www.npmjs.com/package/eslint-plugin-eslint-plugin).
118+
- All `@mysticatea/node/*` rules are imported from [eslint-plugin-node](https://www.npmjs.com/package/eslint-plugin-node).
119+
- All `@mysticatea/ts/*` rules are imported from [eslint-plugin-typescript](https://www.npmjs.com/package/eslint-plugin-typescript).
120+
- All `@mysticatea/vue/*` rules are imported from [eslint-plugin-vue](https://www.npmjs.com/package/eslint-plugin-vue).
121+
- The `@mysticatea/prettier` rule is imported from [eslint-plugin-prettier](https://www.npmjs.com/package/eslint-plugin-prettier).
128122

129-
> **Q:** Why don't you use those plugins directly?<br>
123+
> **Q:** Why don't you use those plugins directly?
130124
> **A:** The combination with shareable configs and plugins has some problems because shareable configs were not designed to be used with plugins. @nzakas illustrated a way to use plugins as shareable configs together with other plugins in the discussion [eslint/eslint#3458](https://github.com/eslint/eslint/issues/3458#issuecomment-257161846). This is the way.
131125
132126
## 🚥 Semantic Versioning Policy
@@ -135,7 +129,7 @@ This plugin follows [semantic versioning](http://semver.org/) and [ESLint's Sema
135129

136130
## 📰 Changelog
137131

138-
- [GitHub Releases](https://github.com/mysticatea/eslint-plugin/releases)
132+
- [GitHub Releases](https://github.com/mysticatea/eslint-plugin/releases)
139133

140134
## ❤️ Contributing
141135

@@ -145,8 +139,8 @@ Please use GitHub's Issues/PRs.
145139

146140
### Development Tools
147141

148-
- `npm test` runs tests and measures coverage.
149-
- `npm run clean` removes the coverage result of `npm test` command.
150-
- `npm run coverage` shows the coverage result of `npm test` command.
151-
- `npm run update` updates auto-generated files.
152-
- `npm run watch` runs tests and measures coverage when source code are changed.
142+
- `npm test` runs tests and measures coverage.
143+
- `npm run clean` removes the coverage result of `npm test` command.
144+
- `npm run coverage` shows the coverage result of `npm test` command.
145+
- `npm run update` updates auto-generated files.
146+
- `npm run watch` runs tests and measures coverage when source code are changed.

docs/rules/arrow-parens.md

Lines changed: 18 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -12,39 +12,45 @@ This rule ignores arrow functions that there is a open paren before itself.
1212
### The following patterns are considered warnings:
1313

1414
```js
15-
const twice = x => 2 * x;
15+
const twice = (x) => 2 * x
1616
```
1717

1818
```js
1919
const obj = {
20-
twich: x => 2 * x
21-
};
20+
twich: (x) => 2 * x,
21+
}
2222
```
2323

2424
```js
25-
p.then(x => 2 * x, err => console.error(err));
25+
p.then(
26+
(x) => 2 * x,
27+
(err) => console.error(err)
28+
)
2629
```
2730

2831
### The following patterns are not considered warnings:
2932

3033
```js
31-
const twice = (x) => 2 * x;
32-
const twice = (x => 2 * x);
34+
const twice = (x) => 2 * x
35+
const twice = (x) => 2 * x
3336
```
3437

3538
```js
3639
const obj = {
37-
twich: (x) => 2 * x
38-
};
40+
twich: (x) => 2 * x,
41+
}
3942
const obj2 = {
40-
twich: (x => 2 * x)
41-
};
43+
twich: (x) => 2 * x,
44+
}
4245
```
4346

4447
```js
45-
xs.map(x => 2 * x);
48+
xs.map((x) => 2 * x)
4649
```
4750

4851
```js
49-
p.then(x => 2 * x, (err) => console.error(err));
52+
p.then(
53+
(x) => 2 * x,
54+
(err) => console.error(err)
55+
)
5056
```

0 commit comments

Comments
 (0)