Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add support for ESLint Flat Config #779

Merged
merged 27 commits into from
Jun 14, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
26baaca
feat(deps): update eslint-plugin-react-hooks to canary
k1tikurisu Jun 10, 2024
39fa825
feat: add lib/base, lib/react and presets/react
k1tikurisu Jun 11, 2024
9f8acea
test: load *-test.js prior to root suite execution
k1tikurisu Jun 11, 2024
f09e7bf
test: add test for flat/base.js
k1tikurisu Jun 12, 2024
8069f56
fix: Explicitly use the same eslint-plugin-react in each configuratio…
k1tikurisu Jun 12, 2024
c2f3ae7
fix: glob pattern
k1tikurisu Jun 12, 2024
bc1aecf
test: add test presets/react.js
k1tikurisu Jun 12, 2024
b8c13a7
fix: test command
k1tikurisu Jun 12, 2024
ef768d7
feat: add lib/prettier and presets/prettier
k1tikurisu Jun 12, 2024
620a84b
test: add prefix preset
k1tikurisu Jun 12, 2024
056be05
test: add test preset react-prettier
k1tikurisu Jun 12, 2024
76b3010
fix: flat config languageOptions at flat/base.js
k1tikurisu Jun 12, 2024
a2faceb
feat: add lib/node.js and preset/node.js
k1tikurisu Jun 12, 2024
55814a6
feat: preset/node-prettier.js
k1tikurisu Jun 12, 2024
fbfb7b8
add: feat add lib/es5.js
k1tikurisu Jun 13, 2024
e35a3c1
refactor: change lib args
k1tikurisu Jun 13, 2024
43ce60d
refactor: change args to optional
k1tikurisu Jun 13, 2024
1f6cbe3
feat: add lib/kintone.js and some presets
k1tikurisu Jun 13, 2024
f1f4820
feat(deps): add typescript-eslint
k1tikurisu Jun 13, 2024
274eb54
feat: add lib/typescript and preset/typescript
k1tikurisu Jun 13, 2024
2c5804b
fix: remove files property
k1tikurisu Jun 13, 2024
699275f
feat: add lib/react-typescript.js, lib/react-typescript-prettier.js a…
k1tikurisu Jun 13, 2024
ae54c0f
feat: add some typescript libs
k1tikurisu Jun 13, 2024
434b618
fix: change files property flat/recommended-script to flat/recommende…
k1tikurisu Jun 13, 2024
d2848b3
refactor: remove files args from libs
k1tikurisu Jun 14, 2024
f954851
docs: update README.md
k1tikurisu Jun 14, 2024
31891ab
docs: fix typo
k1tikurisu Jun 14, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 28 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,17 +39,19 @@ This is a rule you should fix because the code style might not be preferable.

1. We update major version if the changes might cause new errors.
1. We update minor version if the changes might cause new warnings.
1. We update patch version if the changes don't cause any new errors and warings.
1. We update patch version if the changes don't cause any new errors and warnings.

## How to use

Install `eslint` and `@cybozu/eslint-config` and put it into your `.eslintrc.js`
Install `eslint` and `@cybozu/eslint-config`

```
% npm install --save-dev eslint @cybozu/eslint-config
```

- `.eslintrc.js`
### `.eslintrc.js`

Put it into your `.eslintrc.js`

```js
module.exports = {
Expand All @@ -63,7 +65,7 @@ We think it's important to have consistency in your entire codebase.**

```js
module.exports = {
extends: "@cybozu",
extends: "@cybozu/eslint-config/presets/react-typescript-prettier",
rules: {
// default
// 'indent': ['warn', 2, { "SwitchCase": 1 }],
Expand All @@ -72,6 +74,28 @@ module.exports = {
};
```

### `eslint.config.js` (Flat Config)

> [!NOTE]
> Flat Config support is experimental. The applicable rules and scope may have changed.

Put it into your `.eslint.config.js`

```js
const config = require("@cybozu/eslint-config/flat/presets/react-typescript-prettier")

module.exports = [
...config,
{
rules: {
// default
// 'indent': ['warn', 2, { "SwitchCase": 1 }],
indent: ["warn", 4, { SwitchCase: 0 }]
}
},
]
```

## Support rule set

- `@cybozu`
Expand Down
18 changes: 18 additions & 0 deletions flat/globals/kintone.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
/**
* @type import("eslint").ESLint.Globals}
*/
module.exports = {
$: false,
jQuery: false,
kintone: false,
moment: false,
Handsontable: false,
hljs: false,
marked: false,
sweetAlert: false,
swal: false,
Chart: false,
DOMPurify: false,
Spinner: false,
UltraDate: false,
};
Loading