From b9c377c9b1c2dc8840622027c996cf626f996920 Mon Sep 17 00:00:00 2001 From: gentlementlegen Date: Tue, 28 May 2024 09:32:42 +0900 Subject: [PATCH] fix: moved eslint from js to json and accept numbers in file names --- .eslintrc | 56 +++++++++++++++++++++++++++++++++++++++++++++++++ .eslintrc.js | 59 ---------------------------------------------------- 2 files changed, 56 insertions(+), 59 deletions(-) create mode 100644 .eslintrc delete mode 100644 .eslintrc.js diff --git a/.eslintrc b/.eslintrc new file mode 100644 index 0000000..5fa69fa --- /dev/null +++ b/.eslintrc @@ -0,0 +1,56 @@ +{ + "root": true, + "parser": "@typescript-eslint/parser", + "parserOptions": { + "project": ["./tsconfig.json"] + }, + "plugins": ["@typescript-eslint", "sonarjs", "filename-rules"], + "extends": ["eslint:recommended", "plugin:@typescript-eslint/recommended", "plugin:sonarjs/recommended"], + "ignorePatterns": ["**/*.js"], + "rules": { + "filename-rules/match": [2, "/^(e2e\\.ts$|.*\/e2e\\.ts$|[a-z0-9]+(?:[-._a-z0-9]+)*\\.ts|\\.[a-z0-9]+)$/"], + "prefer-arrow-callback": ["warn", { "allowNamedFunctions": true }], + "func-style": ["warn", "declaration", { "allowArrowFunctions": false }], + "@typescript-eslint/no-floating-promises": "error", + "@typescript-eslint/no-non-null-assertion": "error", + "constructor-super": "error", + "no-invalid-this": "off", + "@typescript-eslint/no-invalid-this": ["error"], + "no-restricted-syntax": ["error", "ForInStatement"], + "use-isnan": "error", + "no-unneeded-ternary": "error", + "no-nested-ternary": "error", + "@typescript-eslint/no-unused-vars": [ + "error", + { + "args": "after-used", + "ignoreRestSiblings": true, + "vars": "all", + "varsIgnorePattern": "^_", + "argsIgnorePattern": "^_" + } + ], + "@typescript-eslint/await-thenable": "error", + "@typescript-eslint/no-misused-new": "error", + "@typescript-eslint/restrict-plus-operands": "error", + "sonarjs/no-all-duplicated-branches": "error", + "sonarjs/no-collection-size-mischeck": "error", + "sonarjs/no-duplicated-branches": "error", + "sonarjs/no-element-overwrite": "error", + "sonarjs/no-identical-conditions": "error", + "sonarjs/no-identical-expressions": "error", + "@typescript-eslint/naming-convention": [ + "error", + { "selector": "interface", "format": ["StrictPascalCase"], "custom": { "regex": "^I[A-Z]", "match": false } }, + { "selector": "memberLike", "modifiers": ["private"], "format": ["strictCamelCase"], "leadingUnderscore": "require" }, + { "selector": "typeLike", "format": ["StrictPascalCase"] }, + { "selector": "typeParameter", "format": ["StrictPascalCase"], "prefix": ["T"] }, + { "selector": "variable", "format": ["strictCamelCase", "UPPER_CASE"], "leadingUnderscore": "allow", "trailingUnderscore": "allow" }, + { "selector": "variable", "format": ["strictCamelCase"], "leadingUnderscore": "allow", "trailingUnderscore": "allow" }, + { "selector": "variable", "modifiers": ["destructured"], "format": null }, + { "selector": "variable", "types": ["boolean"], "format": ["StrictPascalCase"], "prefix": ["is", "should", "has", "can", "did", "will", "does"] }, + { "selector": "variableLike", "format": ["strictCamelCase"] }, + { "selector": ["function", "variable"], "format": ["strictCamelCase"] } + ] + } +} diff --git a/.eslintrc.js b/.eslintrc.js deleted file mode 100644 index d454c0f..0000000 --- a/.eslintrc.js +++ /dev/null @@ -1,59 +0,0 @@ -/** - * @type {import("eslint").Linter.Config} - */ -module.exports = { - root: true, - parser: "@typescript-eslint/parser", - parserOptions: { - project: ["./tsconfig.json"], - }, - plugins: ["@typescript-eslint", "sonarjs", "filename-rules"], - extends: ["eslint:recommended", "plugin:@typescript-eslint/recommended", "plugin:sonarjs/recommended"], - ignorePatterns: ["**/*.js"], - rules: { - "filename-rules/match": [2, /^(e2e\.ts$|.*\/e2e\.ts$|[a-z]+(?:[-._a-z]+)*\.ts|\.[a-z]+)$/], - "prefer-arrow-callback": ["warn", { allowNamedFunctions: true }], - "func-style": ["warn", "declaration", { allowArrowFunctions: false }], - "@typescript-eslint/no-floating-promises": "error", - "@typescript-eslint/no-non-null-assertion": "error", - "constructor-super": "error", - "no-invalid-this": "off", - "@typescript-eslint/no-invalid-this": ["error"], - "no-restricted-syntax": ["error", "ForInStatement"], - "use-isnan": "error", - "no-unneeded-ternary": "error", - "no-nested-ternary": "error", - "@typescript-eslint/no-unused-vars": [ - "error", - { - args: "after-used", - ignoreRestSiblings: true, - vars: "all", - varsIgnorePattern: "^_", - argsIgnorePattern: "^_", - }, - ], - "@typescript-eslint/await-thenable": "error", - "@typescript-eslint/no-misused-new": "error", - "@typescript-eslint/restrict-plus-operands": "error", - "sonarjs/no-all-duplicated-branches": "error", - "sonarjs/no-collection-size-mischeck": "error", - "sonarjs/no-duplicated-branches": "error", - "sonarjs/no-element-overwrite": "error", - "sonarjs/no-identical-conditions": "error", - "sonarjs/no-identical-expressions": "error", - "@typescript-eslint/naming-convention": [ - "error", - { selector: "interface", format: ["StrictPascalCase"], custom: { regex: "^I[A-Z]", match: false } }, - { selector: "memberLike", modifiers: ["private"], format: ["strictCamelCase"], leadingUnderscore: "require" }, - { selector: "typeLike", format: ["StrictPascalCase"] }, - { selector: "typeParameter", format: ["StrictPascalCase"], prefix: ["T"] }, - { selector: "variable", format: ["strictCamelCase", "UPPER_CASE"], leadingUnderscore: "allow", trailingUnderscore: "allow" }, - { selector: "variable", format: ["strictCamelCase"], leadingUnderscore: "allow", trailingUnderscore: "allow" }, - { selector: "variable", modifiers: ["destructured"], format: null }, - { selector: "variable", types: ["boolean"], format: ["StrictPascalCase"], prefix: ["is", "should", "has", "can", "did", "will", "does"] }, - { selector: "variableLike", format: ["strictCamelCase"] }, - { selector: ["function", "variable"], format: ["strictCamelCase"] }, - ], - }, -};