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

ESLintを最新にしてFlat Configにする #2560

Open
wants to merge 36 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
36 commits
Select commit Hold shift + click to select a range
07c10bf
⬆️ ESLint周りの依存関係を更新
MT224244 Aug 12, 2024
07a3d93
🔧 Flat Configに書き換え
MT224244 Aug 12, 2024
215c8c8
🚨 推奨ルールの変更等で出た警告を修正
MT224244 Aug 12, 2024
e86adb3
⬆️ ESLint周りの依存関係を更新
MT224244 Jan 11, 2025
e8892e3
🔧 FlatConfigの設定を更新
MT224244 Jan 11, 2025
6bc51f2
Merge branch 'main' into flat-config
MT224244 Jan 11, 2025
8b63764
🔧 FlatConfigの設定を更新(問題あり)
MT224244 Jan 11, 2025
7f36254
🔨 eslintのカスタムルールをFlatConfig用に修正(拡張子変更のみ)
MT224244 Jan 15, 2025
084b4d8
🔨 eslintのカスタムルールをFlatConfig用に修正
MT224244 Jan 15, 2025
8f1c3f9
🔧 FlatConfigの設定を更新(問題あり)
MT224244 Jan 15, 2025
fc5847f
🔧 FlatConfigの設定を更新(問題あり)
MT224244 Jan 17, 2025
b3cd0f0
⬆️ ESLint周りの依存関係を更新
MT224244 Jan 27, 2025
fb806f3
Merge remote-tracking branch 'upstream/main' into flat-config
MT224244 Jan 27, 2025
4d46e22
Merge remote-tracking branch 'upstream/main' into flat-config
MT224244 Feb 2, 2025
02d1f1e
⬆️ ESLint周りの依存関係を更新
MT224244 Feb 2, 2025
dcdea3a
🔧 tsconfigのincludeにeslint-pluginディレクトリのmtsファイルを追加
MT224244 Feb 2, 2025
807689e
Merge remote-tracking branch 'upstream/main' into flat-config
MT224244 Feb 12, 2025
261b0c9
🔧 ESLintのimport/orderが使えるようになったので戻す
MT224244 Feb 16, 2025
9dbd145
⬆️ ESLint周りの依存関係を更新
MT224244 Feb 16, 2025
c366b5d
⬆️ ESLint周りの依存関係を更新
MT224244 Feb 22, 2025
e3281b5
🔧 FlatConfigの設定を更新
MT224244 Feb 22, 2025
5b2dc22
🔧 FlatConfigの設定を更新
MT224244 Feb 22, 2025
ee3446a
Merge remote-tracking branch 'upstream/main' into flat-config
MT224244 Feb 22, 2025
09bf6b3
🔧 inspectorのコマンドを変更
MT224244 Feb 24, 2025
9f9ede0
🚨 fmtしてみた
MT224244 Feb 24, 2025
ceca417
🚨 簡単に直せそうなところだけ
MT224244 Feb 24, 2025
e0eeb89
🏷️ 型を修正
MT224244 Feb 25, 2025
419ff00
💡 pluginConfigにコメントを追加
MT224244 Feb 25, 2025
a90e178
🩹 __dirnameの取得先を変更
MT224244 Feb 26, 2025
66e1f96
🩹 typescript-eslintのconfigsに分かりやすい名前を付ける
MT224244 Feb 26, 2025
5edef89
🔧 ESLintのfilesを見直し
MT224244 Feb 26, 2025
e35d39d
🔧 非推奨のルールが残ってたので修正
MT224244 Feb 26, 2025
8968074
Merge remote-tracking branch 'upstream/main' into flat-config
MT224244 Feb 26, 2025
1a70751
🔨 package.jsonをrequireではなくimportで取り込むよう変更
MT224244 Feb 26, 2025
4b3435f
🔧 no-empty-object-typeの指定を削除
MT224244 Feb 26, 2025
7d78552
Merge branch 'main' into flat-config
Hiroshiba Feb 26, 2025
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
152 changes: 0 additions & 152 deletions .eslintrc.js

This file was deleted.

2 changes: 1 addition & 1 deletion build/afterAllArtifactBuild.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/* eslint-disable @typescript-eslint/no-var-requires */
/* eslint-disable @typescript-eslint/no-require-imports */
const afterWindowsNsisWebArtifactBuild =
require("./afterNsisWebArtifactBuild").default;

Expand Down
2 changes: 1 addition & 1 deletion build/afterNsisWebArtifactBuild.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/* eslint-disable @typescript-eslint/no-var-requires */
/* eslint-disable @typescript-eslint/no-require-imports */
const splitNsisArchive = require("./splitNsisArchive").default;

// target: electron-builder.Target
Expand Down
2 changes: 1 addition & 1 deletion build/splitNsisArchive.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/* eslint-disable @typescript-eslint/no-var-requires */
/* eslint-disable @typescript-eslint/no-require-imports */
const crypto = require("crypto");
const fs = require("fs");
const path = require("path");
Expand Down
1 change: 1 addition & 0 deletions electron-builder.config.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
/* eslint-disable @typescript-eslint/no-require-imports */
// @ts-check
const path = require("path");
const fs = require("fs");
Expand Down
6 changes: 0 additions & 6 deletions eslint-plugin/create-rule.js

This file was deleted.

7 changes: 7 additions & 0 deletions eslint-plugin/create-rule.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
// @ts-check
import { ESLintUtils } from "@typescript-eslint/utils";

export const createRule = ESLintUtils.RuleCreator(
(name) =>
`https://github.com/VOICEVOX/voicevox/blob/main/eslint-plugin/${name}.md`,
);
8 changes: 8 additions & 0 deletions eslint-plugin/index.d.mts
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
import { FlatConfig } from "@typescript-eslint/utils/ts-eslint";

declare const plugin: {
configs: {
all: FlatConfig.ConfigArray;
};
};
export default plugin;
14 changes: 0 additions & 14 deletions eslint-plugin/index.js

This file was deleted.

33 changes: 33 additions & 0 deletions eslint-plugin/index.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
// @ts-check
import noStrictNullable from "./no-strict-nullable.mjs";
import pkg from "./package.json" with { type: "json" };

/** @type {import("@typescript-eslint/utils/ts-eslint").FlatConfig.Plugin["rules"]} */
const rules = {
"no-strict-nullable": noStrictNullable,
};

/** @type {import("@typescript-eslint/utils/ts-eslint").FlatConfig.Plugin} */
const plugin = {
meta: { name: pkg.name, version: pkg.version },
rules,
};

/** @type {import("@typescript-eslint/utils/ts-eslint").FlatConfig.Plugin} */
const voicevoxPlugin = {
configs: {
all: [
{
name: "@voicevox/all",
plugins: {
"@voicevox": plugin,
},
rules: {
"@voicevox/no-strict-nullable": "error",
},
},
],
},
};

export default voicevoxPlugin;
Original file line number Diff line number Diff line change
@@ -1,22 +1,22 @@
// @ts-check
const { AST_NODE_TYPES } = require("@typescript-eslint/utils");
const { createRule } = require("./create-rule");
import { AST_NODE_TYPES } from "@typescript-eslint/utils";
import { createRule } from "./create-rule.mjs";

/**
* @param {import("@typescript-eslint/types").TSESTree.BinaryExpression["left"]} node
* @param {import("@typescript-eslint/utils").TSESTree.Expression} node
*/
function isNull(node) {
return node.type === AST_NODE_TYPES.Literal && node.value == null;
}

/**
* @param {import("@typescript-eslint/types").TSESTree.BinaryExpression["right"]} node
* @param {import("@typescript-eslint/utils").TSESTree.Expression} node
*/
function isUndefined(node) {
return node.type === AST_NODE_TYPES.Identifier && node.name === "undefined";
}

module.exports = createRule({
const noStrictNullable = createRule({
create(context) {
return {
BinaryExpression(node) {
Expand All @@ -33,7 +33,7 @@ module.exports = createRule({
fix(fixer) {
return fixer.replaceTextRange(
[node.left.range[1], node.right.range[0]],
node.operator.slice(0, 2) + " "
node.operator.slice(0, 2) + " ",
);
},
});
Expand All @@ -45,7 +45,6 @@ module.exports = createRule({
type: "problem",
docs: {
description: "undefinedとnullと比較する際に厳密等価演算子を使わない",
recommended: "error",
},
messages: {
report:
Expand All @@ -56,3 +55,5 @@ module.exports = createRule({
},
defaultOptions: [],
});

export default noStrictNullable;
2 changes: 1 addition & 1 deletion eslint-plugin/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@
"name": "@voicevox/eslint-plugin",
"version": "0.0.0",
"description": "eslint plugin for voicevox",
"main": "index.js"
"main": "index.mjs"
}
Loading
Loading