Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 0 additions & 3 deletions .eslintignore

This file was deleted.

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

This file was deleted.

2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
MIT License

Copyright (c) 2020-2024 Estonian Information System Authority
Copyright (c) 2020-2025 Estonian Information System Authority

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
106 changes: 106 additions & 0 deletions eslint.config.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,106 @@
import eslint from "@eslint/js";
import globals from "globals";
import stylisticJs from "@stylistic/eslint-plugin-js";
import stylisticTs from "@stylistic/eslint-plugin-ts";
import tseslint from "typescript-eslint";

const sharedOptions = {
js: {
files: ["**/*.{js,mjs}"],

languageOptions: {
sourceType: "module",

globals: {
...globals.browser,
...globals.node,
...globals.es2021,
...globals.webextensions,
},
},
},

ts: {
files: ["**/*.ts"],

languageOptions: {
sourceType: "module",

globals: {
...globals.browser,
...globals.node,
...globals.es2021,
...globals.webextensions,
},

parser: tseslint.parser,

parserOptions: {
project: "./tsconfig.eslint.json",
tsconfigRootDir: import.meta.dirname,
},
},
},
};

const overrides = {
js: {
...sharedOptions.js,

name: "web-eid/js/override",

plugins: { "@stylistic/js": stylisticJs },

rules: {
"sort-imports": ["error", { allowSeparatedGroups: true }],

"@stylistic/js/quotes": "error",
"@stylistic/js/key-spacing": ["error", { "align": "value" }],
"@stylistic/js/comma-dangle": ["error", "always-multiline"],
"@stylistic/js/object-curly-spacing": ["error", "always"],
"@stylistic/js/array-bracket-spacing": "error",
"@stylistic/js/indent": ["error", 2, { "SwitchCase": 1 }],
"@stylistic/js/semi": "error",
},
},

ts: {
...sharedOptions.ts,

name: "web-eid/ts/override",

plugins: {
"@typescript-eslint": tseslint.plugin,
"@stylistic/ts": stylisticTs,
},

rules: {
"@typescript-eslint/array-type": ["error", { default: "generic" }],
"@stylistic/ts/semi": "error",
},
},
};

export default [
{ ignores: ["dist/", "node_modules/"] },

{
name: "eslint/recommended",

...eslint.configs.recommended,
...sharedOptions.js,
},

...tseslint.configs.recommendedTypeChecked.map((recommended) => ({
...recommended,
...sharedOptions.ts,
})),

...tseslint.configs.stylisticTypeChecked.map((stylistic) => ({
...stylistic,
...sharedOptions.ts,
})),

overrides.js,
overrides.ts,
];
6 changes: 0 additions & 6 deletions jest.config.js

This file was deleted.

7 changes: 7 additions & 0 deletions jest.config.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
/** @type {import('jest').Config} */
const config = {
preset: "ts-jest",
testEnvironment: "jsdom",
};

export default config;
Loading
Loading