177 lines
6.4 KiB
JavaScript
177 lines
6.4 KiB
JavaScript
/* eslint-disable @typescript-eslint/naming-convention */
|
|
// @ts-check
|
|
import cspellESLint from "@cspell/eslint-plugin/recommended";
|
|
import js from "@eslint/js";
|
|
import checkFile from "eslint-plugin-check-file";
|
|
import perfectionist from "eslint-plugin-perfectionist";
|
|
import eslintPluginPrettierRecommended from "eslint-plugin-prettier/recommended";
|
|
import roblox from "eslint-plugin-roblox-ts";
|
|
import unusedImports from "eslint-plugin-unused-imports";
|
|
import { defineConfig, globalIgnores } from "eslint/config";
|
|
import ts from "typescript-eslint";
|
|
|
|
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
// @ts-ignore
|
|
const { "sort-arrays": _, ...perfectionistRules } = perfectionist.rules; // eslint-disable-line @typescript-eslint/no-unused-vars
|
|
|
|
export default defineConfig(
|
|
js.configs.recommended,
|
|
ts.configs.recommended,
|
|
roblox.configs.recommended,
|
|
{
|
|
...perfectionist.configs["recommended-natural"],
|
|
rules: Object.fromEntries(
|
|
Object.keys(perfectionistRules).map((ruleName) => [
|
|
`perfectionist/${ruleName}`,
|
|
[
|
|
"warn",
|
|
{
|
|
order: "asc",
|
|
type: "natural",
|
|
},
|
|
],
|
|
]),
|
|
),
|
|
},
|
|
eslintPluginPrettierRecommended,
|
|
cspellESLint,
|
|
{
|
|
plugins: {
|
|
"check-file": checkFile,
|
|
"unused-imports": unusedImports,
|
|
},
|
|
rules: {
|
|
"@typescript-eslint/naming-convention": [
|
|
"warn",
|
|
{
|
|
format: ["PascalCase"],
|
|
selector: "class",
|
|
},
|
|
{
|
|
format: ["camelCase"],
|
|
selector: "classMethod",
|
|
},
|
|
{
|
|
format: ["camelCase"],
|
|
selector: "classProperty",
|
|
},
|
|
{
|
|
format: ["PascalCase"],
|
|
selector: "enum",
|
|
},
|
|
{
|
|
format: ["PascalCase"],
|
|
selector: "enumMember",
|
|
},
|
|
{
|
|
custom: {
|
|
match: true,
|
|
regex: "^(use[A-Z][a-zA-Z0-9]*|select[A-Z][a-zA-Z0-9]*|[A-Z][a-zA-Z0-9]*)$",
|
|
},
|
|
format: ["PascalCase", "camelCase"],
|
|
modifiers: ["exported"],
|
|
selector: "function",
|
|
},
|
|
{
|
|
format: ["PascalCase"],
|
|
leadingUnderscore: "allowSingleOrDouble",
|
|
selector: "interface",
|
|
trailingUnderscore: "allowSingleOrDouble",
|
|
},
|
|
{
|
|
format: ["PascalCase", "camelCase"],
|
|
selector: "objectLiteralMethod",
|
|
},
|
|
{
|
|
format: ["PascalCase", "camelCase"],
|
|
selector: "objectLiteralProperty",
|
|
},
|
|
{
|
|
format: ["PascalCase", "camelCase"],
|
|
selector: "objectLiteralProperty",
|
|
},
|
|
{
|
|
format: ["camelCase"],
|
|
selector: "parameter",
|
|
},
|
|
{
|
|
format: ["camelCase", "PascalCase"],
|
|
modifiers: ["destructured"],
|
|
selector: "parameter",
|
|
},
|
|
{
|
|
format: ["camelCase"],
|
|
selector: "parameterProperty",
|
|
},
|
|
{
|
|
format: ["StrictPascalCase"],
|
|
selector: "typeAlias",
|
|
},
|
|
{
|
|
custom: {
|
|
match: true,
|
|
regex: "^(on[A-Z][a-zA-Z0-9]*|[A-Z][a-zA-Z0-9]*)$",
|
|
},
|
|
format: ["StrictPascalCase", "strictCamelCase"],
|
|
selector: "typeMethod",
|
|
},
|
|
{
|
|
format: ["StrictPascalCase"],
|
|
selector: "typeParameter",
|
|
},
|
|
{
|
|
format: ["strictCamelCase", "StrictPascalCase", "UPPER_CASE"],
|
|
leadingUnderscore: "allowSingleOrDouble",
|
|
selector: "typeProperty",
|
|
trailingUnderscore: "allowSingleOrDouble",
|
|
},
|
|
{
|
|
format: ["strictCamelCase", "StrictPascalCase", "UPPER_CASE"],
|
|
leadingUnderscore: "allowSingleOrDouble",
|
|
selector: "typeProperty",
|
|
trailingUnderscore: "allowSingleOrDouble",
|
|
},
|
|
{
|
|
format: ["UPPER_CASE", "PascalCase"],
|
|
modifiers: ["exported", "const"],
|
|
selector: "variable",
|
|
},
|
|
{
|
|
custom: {
|
|
match: true,
|
|
regex: "^(use[A-Z][a-zA-Z0-9]*|get[A-Z][a-zA-Z0-9]*|[A-Z][a-zA-Z0-9]*|[a-z][a-zA-Z0-9]*Atom)$",
|
|
},
|
|
format: ["PascalCase", "camelCase"],
|
|
modifiers: ["exported", "const"],
|
|
selector: "variable",
|
|
types: ["function"],
|
|
},
|
|
{
|
|
format: ["UPPER_CASE"],
|
|
modifiers: ["exported", "const"],
|
|
selector: "variable",
|
|
types: ["boolean", "number", "string"],
|
|
},
|
|
],
|
|
"@typescript-eslint/no-array-constructor": "off",
|
|
"@typescript-eslint/no-empty-object-type": "off",
|
|
"@typescript-eslint/no-require-imports": "off",
|
|
"@typescript-eslint/no-unused-vars": [
|
|
"error",
|
|
{
|
|
varsIgnorePattern: "^[A-Z].*(Service|Controller|Component)$",
|
|
},
|
|
],
|
|
"check-file/filename-naming-convention": [
|
|
"error",
|
|
{ "**/*": "KEBAB_CASE" },
|
|
{ ignoreMiddleExtensions: true },
|
|
],
|
|
"check-file/folder-naming-convention": ["error", { "**/": "KEBAB_CASE" }],
|
|
"no-array-constructor": "off",
|
|
"prettier/prettier": "warn",
|
|
},
|
|
},
|
|
globalIgnores(["out", "**/assets.d.ts", "scripts"]),
|
|
);
|