Migrate eslint to flat config

This commit is contained in:
Thomas Gideon 2024-06-24 17:47:03 -04:00
parent 38ed3c3618
commit adf8da85e9
7 changed files with 30 additions and 17 deletions

View file

@ -1,2 +0,0 @@
dist
node_modules

View file

@ -1,10 +0,0 @@
module.exports = {
root: true,
parser: "@typescript-eslint/parser",
plugins: ["@typescript-eslint"],
extends: [
"eslint:recommended",
"plugin:@typescript-eslint/recommended",
"prettier",
],
};

27
eslint.config.mjs Normal file
View file

@ -0,0 +1,27 @@
import { FlatCompat } from "@eslint/eslintrc";
import path from "path";
import { fileURLToPath } from "url";
import ts from "@typescript-eslint/eslint-plugin";
import js from "@eslint/js";
import parser from "@typescript-eslint/parser";
const __filename = fileURLToPath(import.meta.url);
const __dirname = path.dirname(__filename);
const compat = new FlatCompat({
baseDirectory: __dirname
});
export default [
js.configs.recommended,
...compat.extends("plugin:@typescript-eslint/recommended"),
...compat.extends("prettier"),
{
ignores: [ "jest.config.js", "node_modules/*" ],
files: [ "**/*.ts" ],
languageOptions: {
parser: parser,
},
plugins: { "@typescript-eslint": ts },
}
];

View file

@ -1,3 +1,4 @@
/* eslint-disable */
const { compilerOptions } = require("./tsconfig.json");
/** @type {import('ts-jest/dist/types').InitialOptionsTsJest} */

View file

@ -13,8 +13,8 @@
},
"scripts": {
"clean": "yarn cache clean && rm -rf dist",
"lint": "yarn run eslint . --ext .ts",
"lint:fix": "yarn run eslint --fix . --ext .ts",
"lint": "yarn run eslint .",
"lint:fix": "yarn run eslint --fix .",
"format:check": "yarn run prettier --check src/**",
"format": "yarn run prettier --write src/**",
"test": "yarn jest",

View file

@ -2,7 +2,6 @@ import { Err, Ok } from "..";
import { isResult, __internals } from "../guards";
describe("guards.ts", () => {
/* eslint-disable @typescript-eslint/no-empty-function */
const combinators = {
and: () => {},
andThen: () => {},
@ -16,7 +15,6 @@ describe("guards.ts", () => {
yieldOr: () => {},
yieldOrElse: () => {},
};
/* eslint-enable */
const mockSuccess = {
kind: "ok",

View file

@ -213,7 +213,6 @@ export namespace Result {
return this;
}
// eslint-disable-next-line @typescript-eslint/no-unused-vars
yieldOr<U>(_: U, f: (t: T) => U): Result<U, never> {
return this.yield(f);
}