Skip to content

Commit

Permalink
Migrate to ESLint flat config
Browse files Browse the repository at this point in the history
  • Loading branch information
diskdance committed Apr 13, 2024
1 parent d61b529 commit 5f4e092
Show file tree
Hide file tree
Showing 6 changed files with 341 additions and 221 deletions.
6 changes: 0 additions & 6 deletions .eslintignore

This file was deleted.

39 changes: 0 additions & 39 deletions .eslintrc.json

This file was deleted.

59 changes: 59 additions & 0 deletions eslint.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
// @ts-check

import eslint from '@eslint/js';
import tsEslint from 'typescript-eslint';
import globals from 'globals';

export default tsEslint.config(
eslint.configs.recommended,
...tsEslint.configs.recommended,
{
ignores: [
'dist',
'node_modules',
'typings.d.ts',
'assets',
'.rollup.cache',
],
},
{
files: ['lib/*.js'],
languageOptions: {
globals: globals.browser,
},
},
{
files: ['*.config.js'],
languageOptions: {
globals: globals.node,
},
},
{
files: ['**/*.js'],
rules: {
semi: 'error',
'comma-dangle': [
'error',
'always-multiline',
],
quotes: [
'error',
'single',
{
avoidEscape: true,
allowTemplateLiterals: true,
},
],
'max-len': [
'error',
{
code: 100,
ignoreComments: true,
ignoreStrings: true,
ignoreTemplateLiterals: true,
},
],
'quote-props': ['error', 'as-needed'],
},
},
);
1 change: 1 addition & 0 deletions lib/env.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ export declare global {
const COMPAT: boolean;

namespace mw {
// eslint-disable-next-line @typescript-eslint/no-explicit-any
const libs: Record<string, any>;
}
}
12 changes: 7 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,23 +20,25 @@
"test": "jest"
},
"devDependencies": {
"@eslint/js": "^8.56.0",
"@rollup/plugin-replace": "^5.0.2",
"@rollup/plugin-typescript": "^9.0.2",
"@types/jest": "^28.1.6",
"@types/jquery": "^3.5.14",
"@typescript-eslint/eslint-plugin": "^5.30.6",
"@typescript-eslint/parser": "^5.30.6",
"eslint": "^8.20.0",
"eslint": "^8.56.0",
"globals": "^15.0.0",
"jest": "^28.1.3",
"jest-environment-jsdom": "^29.6.1",
"rollup": "^3.26.3",
"rollup-plugin-mediawiki-gadget": "^1.0.5",
"ts-jest": "^28.0.7",
"types-mediawiki": "^1.4.0",
"typescript": "^4.7.4"
"typescript": "^4.7.4",
"typescript-eslint": "^7.6.0"
},
"dependencies": {
"jquery": "^3.6.0",
"jsdom": "^20.0.0"
"jsdom": "^20.0.0",
"tslib": "^2.6.2"
}
}
Loading

0 comments on commit 5f4e092

Please sign in to comment.