Skip to content

Commit

Permalink
Downgraded ESLint config file
Browse files Browse the repository at this point in the history
Downgraded ESLint config file to use the old cascading config instead of the new flat config. This allows eslint-plugin-import to be used, as it seems to only support the old config.

See:
- import-js/eslint-plugin-import#2556
- eslint/eslint#13481
  • Loading branch information
500-internal-server-error committed Jun 9, 2023
1 parent aa58a4e commit 291fb47
Show file tree
Hide file tree
Showing 3 changed files with 173 additions and 189 deletions.
156 changes: 156 additions & 0 deletions .eslintrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,156 @@
{
"$schema": "https://raw.githubusercontent.com/SchemaStore/schemastore/master/src/schemas/json/eslintrc.json",

"root": true,

"env": {
"node": true,
"es2022": true
},

"plugins": [
"@typescript-eslint",
"import"
],

"parser": "@typescript-eslint/parser",
"parserOptions": {
"ecmaVersion": 2022,
"project": "tsconfig.json"
},

"extends": [
"eslint:recommended",
"plugin:@typescript-eslint/recommended",
"plugin:@typescript-eslint/recommended-requiring-type-checking"
],

"rules": {
// ESLint

// Possible Problems

"no-constructor-return": ["error"],
"no-duplicate-imports": ["error"],
"no-new-native-nonconstructor": ["error"],
"no-promise-executor-return": ["error"],
"no-self-compare": ["error"],
"no-template-curly-in-string": ["error"],
"no-unmodified-loop-condition": ["error"],
"no-unused-private-class-members": ["error"],
"require-atomic-updates": ["error"],

// Suggestions

"arrow-body-style": ["error", "as-needed", {
"requireReturnForObjectLiteral": true
}],
"eqeqeq": ["error", "always"],
"func-style": ["error", "declaration", {
"allowArrowFunctions": true
}],
"no-eval": ["error", { "allowIndirect": false }],
"no-floating-decimal": ["error"],
"no-implied-eval": ["error"],
"no-multi-str": ["error"],
"no-octal-escape": ["error"],
"no-param-reassign": ["error"],
"no-var": ["error"],
"operator-assignment": ["error", "always"],
"prefer-arrow-callback": ["error", {
"allowNamedFunctions": false,
"allowUnboundThis": true
}],
"prefer-const": ["error", {
"destructuring": "any",
"ignoreReadBeforeAssign": false
}],
"prefer-exponentiation-operator": ["error"],
"prefer-named-capture-group": ["error"],
"prefer-numeric-literals": ["error"],
"prefer-regex-literals": ["error", {
"disallowRedundantWrapping": true
}],
"prefer-rest-params": ["error"],
"prefer-spread": ["error"],
"prefer-template": ["error"],
"quote-props": ["error", "as-needed", {
"keywords": true,
"unnecessary": true,
"numbers": false
}],
"radix": ["error", "always"],

// @typescript-eslint/eslint-plugin

// ...tsEslintPlugin.configs["recommended"].rules,
// ...tsEslintPlugin.configs["recommended-requiring-type-checking"].rules,

"@typescript-eslint/explicit-member-accessibility": ["error", {
"accessability": "explicit"
}],
"@typescript-eslint/member-delimiter-style": ["error", {
"multiline": {
"delimiter": "semi",
"requireLast": true
},
"singleline": {
"delimiter": "semi",
"requireLast": true
}
}],
"@typescript-eslint/no-inferrable-types": ["off"],
"@typescript-eslint/no-require-imports": ["error"],
"@typescript-eslint/no-unsafe-declaration-merging": ["error"],
"@typescript-eslint/no-unsafe-enum-comparison": ["error"],
"@typescript-eslint/parameter-properties": ["error", {
"prefer": "parameter-property"
}],
"@typescript-eslint/prefer-literal-enum-member": ["error"],
"@typescript-eslint/prefer-optional-chain": ["error"],
"@typescript-eslint/prefer-string-starts-ends-with": ["error"],
"@typescript-eslint/prefer-ts-expect-error": ["error"],
"@typescript-eslint/require-array-sort-compare": ["error", {
"ignoreStringArrays": true
}],

// eslint-plugin-import

// ...eslintPluginImport.configs.recommended,
// ...eslintPluginImport.configs.typescript,

// Helpful warnings

"import/no-deprecated": ["error"],
"import/no-empty-named-blocks": ["error"],

// Module systems

// Static analysis

"import/no-absolute-path": ["error"],
"import/no-self-import": ["error"],

// Style guide

"import/first": ["error"],
"import/newline-after-import": ["error", {
"considerComments": true
}],
"import/order": ["error", {
"groups": [
["builtin", "external"],
"internal",
["parent", "sibling", "index"],
"type",
"object"
],
"newlines-between": "always",
"alphabetize": {
"order": "asc",
"orderImportKind": "asc",
"caseInsensitive": false
}
}]
}
}
172 changes: 0 additions & 172 deletions eslint.config.js

This file was deleted.

34 changes: 17 additions & 17 deletions src/index.ts
Original file line number Diff line number Diff line change
@@ -1,30 +1,30 @@
import { REST } from "@discordjs/rest";
import Airtable from "airtable";
import { ApplicationCommandData, Client, GatewayIntentBits, Snowflake } from "discord.js";
import * as fs from "fs";
import * as jsonfile from "jsonfile";
import { ApplicationCommandData, Client, GatewayIntentBits, Snowflake } from "discord.js";
import { Session } from "./structures";
import { ISqlite, open } from "sqlite";
import { LazyConnectionProvider, SqliteSessionLogStore } from "./sessionLogStore/sqliteSessionLogStore";
import { PushlogTarget } from "./pushlog/pushlogTarget";
import { PushlogHttp } from "./pushlog/pushlogHttp";
import { PushlogAirtable } from "./pushlog/pushlogAirtable";
import Airtable from "airtable";
import { CompositeLogger } from "./util/loggers/compositeLogger";
import { ConsoleLogger } from "./util/loggers/consoleLogger";
import { DiscordChannelLogger } from "./util/loggers/discordChannelLogger";
import { Logger } from "./util/logger";
import sqlite3 from "sqlite3";

import { LowerHandCommandHandler } from "./commandsHandlers/lowerHandCommandHandler";
import { PushlogCommandHandler } from "./commandsHandlers/pushlogCommandHandler";
import { REST } from "@discordjs/rest";
import { RaiseHandCommandHandler } from "./commandsHandlers/raiseHandCommandHandler";
import { RoutingCommandHandler } from "./router";
import { ServiceLocationsFilter } from "./filters/serviceLocationsFilter";
import { StartCommandHandler } from "./commandsHandlers/startCommandHandler";
import { StatusCommandHandler } from "./commandsHandlers/statusCommandHandler";
import { StopCommandHandler } from "./commandsHandlers/stopCommandHandler";
import { loadEnv } from "./util/env";
import sqlite3 from "sqlite3";
import { ServiceLocationsFilter } from "./filters/serviceLocationsFilter";
import { PushlogAirtable } from "./pushlog/pushlogAirtable";
import { PushlogHttp } from "./pushlog/pushlogHttp";
import { PushlogTarget } from "./pushlog/pushlogTarget";
import { RoutingCommandHandler } from "./router";
import { LazyConnectionProvider, SqliteSessionLogStore } from "./sessionLogStore/sqliteSessionLogStore";
import { Session } from "./structures";
import { ConfigFile, LoggerConfig } from "./util/config";

import { loadEnv } from "./util/env";
import { Logger } from "./util/logger";
import { CompositeLogger } from "./util/loggers/compositeLogger";
import { ConsoleLogger } from "./util/loggers/consoleLogger";
import { DiscordChannelLogger } from "./util/loggers/discordChannelLogger";

const dbFile = "data/session-logs.db";
const dbConfig = { filename: dbFile, driver: sqlite3.Database, mode: sqlite3.OPEN_READWRITE };
Expand Down

0 comments on commit 291fb47

Please sign in to comment.