Skip to content

Commit

Permalink
Update to new eslint config
Browse files Browse the repository at this point in the history
  • Loading branch information
Heliozoa committed Sep 11, 2024
1 parent 6bc732b commit 67fc25e
Show file tree
Hide file tree
Showing 12 changed files with 202 additions and 187 deletions.
10 changes: 0 additions & 10 deletions .eslintignore

This file was deleted.

146 changes: 0 additions & 146 deletions .eslintrc.js

This file was deleted.

2 changes: 0 additions & 2 deletions backend/controllers/oauth.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,11 @@
import { Response, Router } from "express";

/* eslint-disable @typescript-eslint/naming-convention */
interface Token {
access_token: string;
token_type: "bearer";
scope: "public";
created_at: number;
}
/* eslint-enable @typescript-eslint/naming-convention */

const USER = {
username: "TestMyExtension",
Expand Down
114 changes: 114 additions & 0 deletions eslint.config.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,114 @@
import typescriptEslint from "@typescript-eslint/eslint-plugin";
import prettier from "eslint-plugin-prettier";
import sortClassMembers from "eslint-plugin-sort-class-members";
import globals from "globals";
import tsParser from "@typescript-eslint/parser";
import path from "node:path";
import { fileURLToPath } from "node:url";
import js from "@eslint/js";
import { FlatCompat } from "@eslint/eslintrc";

const __filename = fileURLToPath(import.meta.url);
const __dirname = path.dirname(__filename);
const compat = new FlatCompat({
baseDirectory: __dirname,
recommendedConfig: js.configs.recommended,
allConfig: js.configs.all,
});

export default [
{
ignores: [
"!**/.github",
"**/dist",
"**/node_modules",
"**/out",
"**/test-artifacts/",
"**/test-resources/",
"**/submodules/",
"**/.vscode-test/",
"**/vscode.proposed.d.ts",
"**/build/",
],
},
...compat.extends(
"eslint:recommended",
"plugin:@typescript-eslint/recommended",
"plugin:prettier/recommended",
),
{
plugins: {
"@typescript-eslint": typescriptEslint,
prettier,
"sort-class-members": sortClassMembers,
},

languageOptions: {
globals: {
...globals.node,
Atomics: "readonly",
SharedArrayBuffer: "readonly",
},

parser: tsParser,
ecmaVersion: 6,
sourceType: "module",
},

rules: {
"no-unused-vars": "off",

"@typescript-eslint/no-unused-vars": [
"warn",
{
varsIgnorePattern: "^_",
argsIgnorePattern: "^_",
caughtErrorsIgnorePattern: "^_",
destructuredArrayIgnorePattern: "^_",
},
],

"@typescript-eslint/ban-ts-comment": [
"error",
{
"ts-ignore": "allow-with-description",
},
],

curly: "error",

"sort-imports": [
"error",
{
ignoreCase: true,
ignoreDeclarationSort: true,
},
],

"@typescript-eslint/no-var-requires": "off",
},
},
{
files: ["**/*.ts", "**/*.tsx"],

rules: {
"@typescript-eslint/explicit-function-return-type": ["error"],
"@typescript-eslint/explicit-module-boundary-types": ["error"],
"@typescript-eslint/no-var-requires": ["error"],
},
},
{
files: ["**/*.test.ts", "**/*.spec.ts"],

rules: {
"@typescript-eslint/no-unused-expressions": "off",
},
},
{
files: ["**/*.js", "**/*.ts"],

rules: {
"@typescript-eslint/no-require-imports": "off",
},
},
];
Loading

0 comments on commit 67fc25e

Please sign in to comment.