Skip to content

Commit

Permalink
chore: migrate all the eslint config to the new versions
Browse files Browse the repository at this point in the history
  • Loading branch information
Kelvur committed Jul 14, 2024
1 parent 11d167d commit 0221912
Show file tree
Hide file tree
Showing 5 changed files with 69 additions and 5 deletions.
50 changes: 50 additions & 0 deletions eslint.config.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
import { fixupConfigRules, fixupPluginRules } from "@eslint/compat";
import typescriptEslint from "@typescript-eslint/eslint-plugin";
import _import from "eslint-plugin-import";
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: ["dist/*", "lib/*"],
}, ...fixupConfigRules(compat.extends(
"eslint:recommended",
"plugin:@typescript-eslint/recommended",
"plugin:import/typescript",
)), {
plugins: {
"@typescript-eslint": fixupPluginRules(typescriptEslint),
import: fixupPluginRules(_import),
},

languageOptions: {
globals: {
...globals.browser,
...globals.node,
},

parser: tsParser,
},

rules: {
semi: [2, "always"],
"comma-dangle": ["error", "always-multiline"],

"import/newline-after-import": ["error", {
count: 2,
}],

"no-multiple-empty-lines": "off",
},
}];
4 changes: 4 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -42,11 +42,15 @@
"dist"
],
"devDependencies": {
"@eslint/compat": "^1.1.1",
"@eslint/eslintrc": "^3.1.0",
"@eslint/js": "^9.7.0",
"@typescript-eslint/eslint-plugin": "^7.16.0",
"@typescript-eslint/parser": "^7.16.0",
"@vitest/coverage-v8": "^2.0.2",
"eslint": "^9.7.0",
"eslint-plugin-import": "^2.29.1",
"globals": "^15.8.0",
"husky": "^1.1.4",
"release-it": "^17.5.0",
"ts-node": "^10.9.1",
Expand Down
6 changes: 3 additions & 3 deletions src/helpers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ export function createToken (
kind: TokenKind,
start: number,
value: string,
extra?: Partial<Token>
extra?: Partial<Token>,
): Token {
let length = value.length;
if(extra && extra.length !== undefined) {
Expand Down Expand Up @@ -56,7 +56,7 @@ export function createParameterToken (type: TokenType, extra?: Partial<Token>) {
precision,
fLength,
...extra,
})
}),
);
}

Expand All @@ -65,7 +65,7 @@ export function createLiteralToken (start: number, value: string, extra?: Partia
TokenKind.Literal,
start,
value,
extra
extra,
);
}

Expand Down
2 changes: 1 addition & 1 deletion src/printf-tokenize.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ const checkValueAndLength = (str: string, expectedTokens: Array<Token>) => expec

const validateTokens = (
input: string,
expectedTokens: Array<Token>
expectedTokens: Array<Token>,
) => {
expect(printfTokenize(input)).toMatchObject(expectedTokens);
expect(checkValueAndLength(input, expectedTokens)).toBe(true);
Expand Down
12 changes: 11 additions & 1 deletion yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -194,6 +194,11 @@
resolved "https://registry.yarnpkg.com/@eslint-community/regexpp/-/regexpp-4.11.0.tgz#b0ffd0312b4a3fd2d6f77237e7248a5ad3a680ae"
integrity sha512-G/M/tIiMrTAxEWRfLfQJMmGNX28IxBg4PBz8XqQhqUHLFI6TL2htpIB1iQCj144V5ee/JaKyT9/WZ0MGZWfA7A==

"@eslint/compat@^1.1.1":
version "1.1.1"
resolved "https://registry.yarnpkg.com/@eslint/compat/-/compat-1.1.1.tgz#5736523f5105c94dfae5f35e31debc38443722cd"
integrity sha512-lpHyRyplhGPL5mGEh6M9O5nnKk0Gz4bFI+Zu6tKlPpDUN7XshWvH9C/px4UVm87IAANE0W81CEsNGbS1KlzXpA==

"@eslint/config-array@^0.17.0":
version "0.17.0"
resolved "https://registry.yarnpkg.com/@eslint/config-array/-/config-array-0.17.0.tgz#ff305e1ee618a00e6e5d0485454c8d92d94a860d"
Expand All @@ -218,7 +223,7 @@
minimatch "^3.1.2"
strip-json-comments "^3.1.1"

"@eslint/[email protected]":
"@eslint/[email protected]", "@eslint/js@^9.7.0":
version "9.7.0"
resolved "https://registry.yarnpkg.com/@eslint/js/-/js-9.7.0.tgz#b712d802582f02b11cfdf83a85040a296afec3f0"
integrity sha512-ChuWDQenef8OSFnvuxv0TCVxEwmu3+hPNKvM9B34qpM0rDRbjL8t5QkQeHHeAfsKQjuH9wS82WeCi1J/owatng==
Expand Down Expand Up @@ -2245,6 +2250,11 @@ globals@^14.0.0:
resolved "https://registry.yarnpkg.com/globals/-/globals-14.0.0.tgz#898d7413c29babcf6bafe56fcadded858ada724e"
integrity sha512-oahGvuMGQlPw/ivIYBjVSrWAfWLBeku5tpPE2fOPLi+WHffIWbuh2tCjhyQhTBPMf5E9jDEH4FOmTYgYwbKwtQ==

globals@^15.8.0:
version "15.8.0"
resolved "https://registry.yarnpkg.com/globals/-/globals-15.8.0.tgz#e64bb47b619dd8cbf32b3c1a0a61714e33cbbb41"
integrity sha512-VZAJ4cewHTExBWDHR6yptdIBlx9YSSZuwojj9Nt5mBRXQzrKakDsVKQ1J63sklLvzAJm0X5+RpO4i3Y2hcOnFw==

globalthis@^1.0.3:
version "1.0.3"
resolved "https://registry.yarnpkg.com/globalthis/-/globalthis-1.0.3.tgz#5852882a52b80dc301b0660273e1ed082f0b6ccf"
Expand Down

0 comments on commit 0221912

Please sign in to comment.