Skip to content

Commit b345563

Browse files
committed
1.0.0
0 parents  commit b345563

38 files changed

+3040
-0
lines changed

.circleci/config.yml

+51
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
# Javascript Node CircleCI 2.0 configuration file
2+
#
3+
# Check https://circleci.com/docs/2.0/language-javascript/ for more details
4+
#
5+
version: 2
6+
7+
defaults: &defaults
8+
working_directory: ~/repo
9+
10+
steps:
11+
- checkout
12+
13+
# Download and cache dependencies
14+
- restore_cache:
15+
keys:
16+
- v1-dependencies-{{ checksum "package-lock.json" }}
17+
# fallback to using the latest cache if no exact match is found
18+
- v1-dependencies-
19+
20+
- run: npm install
21+
22+
- save_cache:
23+
paths:
24+
- node_modules
25+
key: v1-dependencies-{{ checksum "package-lock.json" }}
26+
27+
# run tests!
28+
- run: npm run lint
29+
- run: npm test
30+
31+
jobs:
32+
node-v6:
33+
<<: *defaults
34+
docker:
35+
- image: circleci/node:6
36+
node-v8:
37+
<<: *defaults
38+
docker:
39+
- image: circleci/node:8
40+
node-v10:
41+
<<: *defaults
42+
docker:
43+
- image: circleci/node:10
44+
45+
workflows:
46+
version: 2
47+
multiple_builds:
48+
jobs:
49+
- node-v6
50+
- node-v8
51+
- node-v10

.eslintignore

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
test/fixtures

.eslintrc.js

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
module.exports = {
2+
extends: "./presets/react-flowtype-prettier.js",
3+
env: {
4+
node: true,
5+
mocha: true
6+
}
7+
};

.gitignore

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
node_modules/
2+
.vscode/

.prettierignore

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
*.json
2+
test/fixtures
3+
CHANGELOG.md

CHANGELOG.md

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
# CHANGELOG
2+
3+
## 1.0.0 (2018/05/29)
4+
5+
* OSS:rocket::rocket::rocket:
6+

LICENSE

+22
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
2+
MIT License
3+
4+
Copyright (c) 2018 Cybozu, Inc.
5+
6+
Permission is hereby granted, free of charge, to any person obtaining a copy
7+
of this software and associated documentation files (the "Software"), to deal
8+
in the Software without restriction, including without limitation the rights
9+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10+
copies of the Software, and to permit persons to whom the Software is
11+
furnished to do so, subject to the following conditions:
12+
13+
The above copyright notice and this permission notice shall be included in all
14+
copies or substantial portions of the Software.
15+
16+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22+
SOFTWARE.

README.md

+140
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,140 @@
1+
# @cybozu/eslint-config
2+
3+
A ESLint rule set for Cybozu.
4+
5+
**This package is intended to use in Cybozu. Currently, this is still in development so the rules might be changed.**
6+
7+
## What is this?
8+
9+
This is a ESLint rule set for Cybozu.
10+
The purpose of `@cybozu/eslint-config` are following
11+
12+
- Share best practices for JavaScript
13+
- Standardize JavaScript coding guideline in Cybozu
14+
- Installation support for ESLint and continuous support for the rule set
15+
16+
## The benefits to adapt this rule
17+
18+
You don't need to care about updates for ESLint and ESLint plugins.
19+
We'll manage the updates and provide CHANGELOG that you need to know so that you can update it easily.
20+
In addition, we'll add some useful plugins into `@cybozu/eslint-config` so you can learn about best practices for JavaScript through `@cybozu/eslint-config`.
21+
22+
## Rule set policies
23+
24+
We provide rules that are Error or Warning.
25+
26+
### Error
27+
28+
This is a rule you must fix because the code might not follow our practices in JavaScript
29+
30+
### Warning
31+
32+
This is a rule you should fix because the code style might not be preferable.
33+
34+
## Version policy
35+
36+
1. We update major version if the changes might cause new errors.
37+
1. We update minor version if the changes might cause new warnings.
38+
1. We update patch version if the changes don't cause any new errors and warings.
39+
40+
## How to use
41+
42+
Install `eslint` and `@cybozu/eslint-config` and put it into your `.eslintrc.js`
43+
44+
```
45+
% npm install eslint @cybozu/eslint-config
46+
```
47+
48+
- `.eslintrc.js`
49+
50+
```js
51+
module.exports = {
52+
extends: "@cybozu"
53+
};
54+
```
55+
56+
**Currently, we adopt that `indent` rule is 2 spaces and having indentation in `switch case`.
57+
You can override the rule if your project adopts 4 spaces or others.
58+
We think it's important to have consistency in your entire codebase.**
59+
60+
```js
61+
module.exports = {
62+
extends: "@cybozu",
63+
rules: {
64+
// default
65+
// 'indent': ['warn', 2, { "SwitchCase": 1 }],
66+
indent: ["warn", 4, { SwitchCase: 0 }]
67+
}
68+
};
69+
```
70+
71+
## Support rule set
72+
73+
### `@cybozu`
74+
75+
This rule set is a basic rules for Cybozu, which supports ES2017 and parse your sources as Modules.
76+
77+
```js
78+
module.exports = {
79+
extends: "@cybozu"
80+
};
81+
```
82+
83+
### [Experimental] `@cybozu/eslint-config/react`
84+
85+
This rule set is for projects using React, which has JSX support and rules related React provided by `eslint-plugin-react` and `eslint-plugin-jsx-ally`.
86+
This rule set includes `@cybozu`.
87+
88+
```js
89+
module.exports = {
90+
extends: "@cybozu/eslint-config/presets/react"
91+
};
92+
```
93+
94+
If you use React and Flow we recommend to use `@cybozu/eslint-config/react-flowtype` instead.
95+
96+
### [Experimental] `@cybozu/eslint-config/flowtype`
97+
98+
This rule set is for projects using Flow, which has Flow support, which is using `eslint-plugin-flowtype`.
99+
100+
```js
101+
module.exports = {
102+
extends: "@cybozu/eslint-config/presets/flowtype"
103+
};
104+
```
105+
106+
If you use React and Flow we recommend to use `@cybozu/eslint-config/react-flowtype` instead.
107+
108+
### [Experimental] `@cybozu/eslint-config/react-flowtype`
109+
110+
This rule set is for projects using React and Flow, which has Flow support in addition to `@cybozu/eslint-config/react`.
111+
112+
```js
113+
module.exports = {
114+
extends: "@cybozu/eslint-config/presets/react-flowtype"
115+
};
116+
```
117+
118+
## [Experimental] Prettier Support
119+
120+
Prettier is a code formatter, which supports not only JavaScript but also other languages.
121+
Prettier is used widely for a code formatter for JavaScript.
122+
123+
It's an opinionated tool but with Prettier, we don't have to discuss code styles in code review.
124+
(No more bikeshed)
125+
126+
`@cybozu/eslint-config` has presets to support Prettier as an experimental.
127+
The presets disable all rules conflicting with Prettier and treat the difference as errors.
128+
You can fix the errors by `--fix` option so you don't have to fix the errors manually.
129+
130+
In order to this, you have to install `prettier` and choose a preset from the followings.
131+
132+
```
133+
% npm install --save-dev prettier
134+
```
135+
136+
- `@cybozu/eslint-config/presets/prettier`
137+
- `@cybozu/eslint-config/presets/react-prettier`
138+
- `@cybouz/eslint-config/presets/react-flowtype-prettier`
139+
140+
**Currently, we don't support customized Prettier config**

index.js

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
module.exports = {
2+
extends: ["./lib/base.js"]
3+
};

0 commit comments

Comments
 (0)