@mitsue/eslint-config
ESLintの基本設定ファイルです。
インストール
npm i --save-dev eslint @mitsue/eslint-config
使用方法
.eslintrc.jsonに下記を追加してください。
{
"extends": [
"@mitsue"
]
}
ECMAScript Modulesを使う場合
.eslintrc.jsonを調整します。parserOptionsに"sourceType": "module"
を記載します。
{
"extends": [
"@mitsue"
],
"parserOptions": {
"sourceType": "module"
}
}
改行コードがCR+LFの場合
.eslintrc.jsonを調整します。rulesのlinebreak-styleに[2, "windows"]
を記載します。
{
"extends": [
"@mitsue"
],
"rules": {
"linebreak-style": [2, "windows"]
}
}
Prettierと一緒に使う場合
Prettierの公式ドキュメントを参考にしてください。
必要なパッケージをインストールします。
npm i --save--dev eslint-config-prettier
.eslintrc.jsonを調整します。extendsの最後にprettierとprettier/prettierを記載します。
{
"extends": [
"@mitsue",
"prettier",
"prettier/prettier"
]
}
ESLintとの対応関係
@mitsue/eslint-config | ESLint |
---|---|
4.1.0 | >=7.30.0 |
4.0.1 | ^7.15.0 |
3.0.0 | ^7.4.0 |
2.0.0 | ^7.4.0 |
1.0.3 | ^7.1.0 |
ファイルが空でもエラーが報告される
ESLintは未知のルールが設定されているとエラーを報告します。
古いバージョンのESLintを利用していないか(このパッケージのpeerDependenciesに指定されているバージョンと合致しているかどうか)ご確認ください。
変更履歴
4.1.0
いまのところ変更点はありません。
- 対象とするESLint(peerDependencies)を>=7.30.0に変更
- ESLint 8への対応
- parserOptionsのecmaVersionをlatestに変更
4.0.1
- ES2015以降のグローバルオブジェクトが無効になっていた問題を修正
4.0.0
- 対象とするESLint(peerDependencies)を^7.15.0に変更
- parserOptionsのecmaVersionを2021に変更
- 以下のenvを無効化
- commonjs
- ルールに関する調整
- no-nonoctal-decimal-escapeを2(エラー)に設定
- no-unsafe-optional-chainingを2(エラー)に設定
3.0.0
- 以下のenvを無効化
- shared-node-browser
- ルールに関する調整
- linebreak-styleをunixに設定
2.0.0
- 対象とするESLint(peerDependencies)を^7.4.0に変更
- parserOptionsのecmaVersionを2020に変更
- 以下のenvを有効化
- es2020
- ルールに関する調整
- prefer-named-capture-groupを2(エラー)に設定
- require-unicode-regexpを2(エラー)に設定
- no-prototype-builtinsを2(エラー)に設定
- padding-line-between-statementsの調整(constとletの直後の空行を必須ではなく任意に設定)
- comma-dangleをalways-multilineに設定
- no-promise-executor-returnを2(エラー)に設定
- no-unreachable-loopを1(警告)に設定
1.0.3
- 対象とするESLint(peerDependencies)を^7.1.0に変更
- ルールに関する調整
- use-isnanのenforceForIndexOfをtrueに設定
- no-unsafe-negationのenforceForOrderingRelationsをtrueに設定
- grouped-accessor-pairsを2(エラー)に設定
- no-constructor-returnを2(エラー)に設定
- no-dupe-else-ifを2(エラー)に設定
- no-setter-returnを2(エラー)に設定
- default-case-lastを2(エラー)に設定
- no-useless-backreferenceを2(エラー)に設定
- no-restricted-exportsを2(エラー)に設定
- accessor-pairsのgetWithoutSetをfalseに設定
- prefer-exponentiation-operatorを2(エラー)に設定
- Node.js & CommonJSに関するルールを削除
- no-loss-of-precisionを1(警告)に設定
- 以下のメソッドにエラーを報告するように調整
- trimLeft()
- trimRight()
1.0.2
- 以下の設定とルールを追加
- reportUnusedDisableDirectivesをtrueに設定
- no-import-assignを2に設定
- prefer-regex-literalsを2に設定
- default-param-lastを2に設定
- 以下のオプションを追加
- accessor-pairs、computed-property-spacingのenforceForClassMembersオプションをtrueに設定
- use-isnanのenforceForSwitchCaseオプションをtrueに設定
1.0.1
- 以下のenvを無効化
- amd
- mocha
- jasmine
- jest
- phantomjs
- protractor
- qunit
- 以下のメソッドにエラーを報告するように調整
- escape()
- unescape()
- substr()
- getYear()
- setYear()
- toGMTString()
- function-paren-newlineをmultilineに設定
1.0.0
- 最初のリリース
License
MIT © Mitsue-Links Co.,Ltd.