Skip to content

Commit

Permalink
Add eslint flat config
Browse files Browse the repository at this point in the history
Update eslint to ^9, run sort-package-json
  • Loading branch information
xShadowBlade committed Sep 4, 2024
1 parent 13be063 commit f687ec2
Show file tree
Hide file tree
Showing 20 changed files with 432 additions and 878 deletions.
42 changes: 0 additions & 42 deletions .eslintrc.json

This file was deleted.

8 changes: 8 additions & 0 deletions dist/game/eMath.game.js
Original file line number Diff line number Diff line change
Expand Up @@ -946,6 +946,7 @@ function decimalFormatGenerator(Decimal2) {
}
},
/** Short omega format */
// eslint-disable-next-line @typescript-eslint/naming-convention
omega_short: {
config: {
greek: "\u03B2\u03B6\u03BB\u03C8\u03A3\u0398\u03A8\u03C9",
Expand Down Expand Up @@ -988,6 +989,7 @@ function decimalFormatGenerator(Decimal2) {
config: {
/** The list of elements */
/* eslint-disable prettier/prettier */
// eslint-disable-next-line @typescript-eslint/naming-convention
element_lists: [
["H"],
["He", "Li", "Be", "B", "C", "N", "O", "F"],
Expand Down Expand Up @@ -1193,6 +1195,7 @@ function decimalFormatGenerator(Decimal2) {
}
},
/** Old scientific format */
// eslint-disable-next-line @typescript-eslint/naming-convention
old_sc: {
/**
* Format the value into old scientific format
Expand Down Expand Up @@ -1249,6 +1252,7 @@ function decimalFormatGenerator(Decimal2) {
}
},
/** Mixed scientific format */
// eslint-disable-next-line @typescript-eslint/naming-convention
mixed_sc: {
/**
* Format the value into mixed scientific format (standard or scientific depending on the value)
Expand Down Expand Up @@ -1663,6 +1667,7 @@ function decimalFormatGenerator(Decimal2) {
ev
};
return {
// eslint-disable-next-line @typescript-eslint/naming-convention
FORMATS: FORMATS2,
formats: formats2
};
Expand Down Expand Up @@ -7726,6 +7731,9 @@ var Game = class _Game {
this.keyManager.changeFps(fps);
this.eventManager.changeFps(fps);
}
// TODO: Implement clearTickers
// public clearTickers(): void {
// }
/**
* Adds a new currency section to the game. {@link GameCurrency} is the class.
* It automatically adds the currency and currencyStatic objects to the data and static objects for saving and loading.
Expand Down
8 changes: 8 additions & 0 deletions dist/game/eMath.game.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -912,6 +912,7 @@ function decimalFormatGenerator(Decimal2) {
}
},
/** Short omega format */
// eslint-disable-next-line @typescript-eslint/naming-convention
omega_short: {
config: {
greek: "\u03B2\u03B6\u03BB\u03C8\u03A3\u0398\u03A8\u03C9",
Expand Down Expand Up @@ -954,6 +955,7 @@ function decimalFormatGenerator(Decimal2) {
config: {
/** The list of elements */
/* eslint-disable prettier/prettier */
// eslint-disable-next-line @typescript-eslint/naming-convention
element_lists: [
["H"],
["He", "Li", "Be", "B", "C", "N", "O", "F"],
Expand Down Expand Up @@ -1159,6 +1161,7 @@ function decimalFormatGenerator(Decimal2) {
}
},
/** Old scientific format */
// eslint-disable-next-line @typescript-eslint/naming-convention
old_sc: {
/**
* Format the value into old scientific format
Expand Down Expand Up @@ -1215,6 +1218,7 @@ function decimalFormatGenerator(Decimal2) {
}
},
/** Mixed scientific format */
// eslint-disable-next-line @typescript-eslint/naming-convention
mixed_sc: {
/**
* Format the value into mixed scientific format (standard or scientific depending on the value)
Expand Down Expand Up @@ -1629,6 +1633,7 @@ function decimalFormatGenerator(Decimal2) {
ev
};
return {
// eslint-disable-next-line @typescript-eslint/naming-convention
FORMATS: FORMATS2,
formats: formats2
};
Expand Down Expand Up @@ -7692,6 +7697,9 @@ var Game = class _Game {
this.keyManager.changeFps(fps);
this.eventManager.changeFps(fps);
}
// TODO: Implement clearTickers
// public clearTickers(): void {
// }
/**
* Adds a new currency section to the game. {@link GameCurrency} is the class.
* It automatically adds the currency and currencyStatic objects to the data and static objects for saving and loading.
Expand Down
5 changes: 5 additions & 0 deletions dist/main/eMath.js
Original file line number Diff line number Diff line change
Expand Up @@ -260,6 +260,7 @@ function decimalFormatGenerator(Decimal2) {
}
},
/** Short omega format */
// eslint-disable-next-line @typescript-eslint/naming-convention
omega_short: {
config: {
greek: "\u03B2\u03B6\u03BB\u03C8\u03A3\u0398\u03A8\u03C9",
Expand Down Expand Up @@ -302,6 +303,7 @@ function decimalFormatGenerator(Decimal2) {
config: {
/** The list of elements */
/* eslint-disable prettier/prettier */
// eslint-disable-next-line @typescript-eslint/naming-convention
element_lists: [
["H"],
["He", "Li", "Be", "B", "C", "N", "O", "F"],
Expand Down Expand Up @@ -507,6 +509,7 @@ function decimalFormatGenerator(Decimal2) {
}
},
/** Old scientific format */
// eslint-disable-next-line @typescript-eslint/naming-convention
old_sc: {
/**
* Format the value into old scientific format
Expand Down Expand Up @@ -563,6 +566,7 @@ function decimalFormatGenerator(Decimal2) {
}
},
/** Mixed scientific format */
// eslint-disable-next-line @typescript-eslint/naming-convention
mixed_sc: {
/**
* Format the value into mixed scientific format (standard or scientific depending on the value)
Expand Down Expand Up @@ -977,6 +981,7 @@ function decimalFormatGenerator(Decimal2) {
ev
};
return {
// eslint-disable-next-line @typescript-eslint/naming-convention
FORMATS: FORMATS2,
formats: formats2
};
Expand Down
5 changes: 5 additions & 0 deletions dist/main/eMath.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -195,6 +195,7 @@ function decimalFormatGenerator(Decimal2) {
}
},
/** Short omega format */
// eslint-disable-next-line @typescript-eslint/naming-convention
omega_short: {
config: {
greek: "\u03B2\u03B6\u03BB\u03C8\u03A3\u0398\u03A8\u03C9",
Expand Down Expand Up @@ -237,6 +238,7 @@ function decimalFormatGenerator(Decimal2) {
config: {
/** The list of elements */
/* eslint-disable prettier/prettier */
// eslint-disable-next-line @typescript-eslint/naming-convention
element_lists: [
["H"],
["He", "Li", "Be", "B", "C", "N", "O", "F"],
Expand Down Expand Up @@ -442,6 +444,7 @@ function decimalFormatGenerator(Decimal2) {
}
},
/** Old scientific format */
// eslint-disable-next-line @typescript-eslint/naming-convention
old_sc: {
/**
* Format the value into old scientific format
Expand Down Expand Up @@ -498,6 +501,7 @@ function decimalFormatGenerator(Decimal2) {
}
},
/** Mixed scientific format */
// eslint-disable-next-line @typescript-eslint/naming-convention
mixed_sc: {
/**
* Format the value into mixed scientific format (standard or scientific depending on the value)
Expand Down Expand Up @@ -912,6 +916,7 @@ function decimalFormatGenerator(Decimal2) {
ev
};
return {
// eslint-disable-next-line @typescript-eslint/naming-convention
FORMATS: FORMATS2,
formats: formats2
};
Expand Down
5 changes: 5 additions & 0 deletions dist/presets/eMath.presets.js
Original file line number Diff line number Diff line change
Expand Up @@ -217,6 +217,7 @@ function decimalFormatGenerator(Decimal2) {
}
},
/** Short omega format */
// eslint-disable-next-line @typescript-eslint/naming-convention
omega_short: {
config: {
greek: "\u03B2\u03B6\u03BB\u03C8\u03A3\u0398\u03A8\u03C9",
Expand Down Expand Up @@ -259,6 +260,7 @@ function decimalFormatGenerator(Decimal2) {
config: {
/** The list of elements */
/* eslint-disable prettier/prettier */
// eslint-disable-next-line @typescript-eslint/naming-convention
element_lists: [
["H"],
["He", "Li", "Be", "B", "C", "N", "O", "F"],
Expand Down Expand Up @@ -464,6 +466,7 @@ function decimalFormatGenerator(Decimal2) {
}
},
/** Old scientific format */
// eslint-disable-next-line @typescript-eslint/naming-convention
old_sc: {
/**
* Format the value into old scientific format
Expand Down Expand Up @@ -520,6 +523,7 @@ function decimalFormatGenerator(Decimal2) {
}
},
/** Mixed scientific format */
// eslint-disable-next-line @typescript-eslint/naming-convention
mixed_sc: {
/**
* Format the value into mixed scientific format (standard or scientific depending on the value)
Expand Down Expand Up @@ -934,6 +938,7 @@ function decimalFormatGenerator(Decimal2) {
ev
};
return {
// eslint-disable-next-line @typescript-eslint/naming-convention
FORMATS: FORMATS2,
formats: formats2
};
Expand Down
5 changes: 5 additions & 0 deletions dist/presets/eMath.presets.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -177,6 +177,7 @@ function decimalFormatGenerator(Decimal2) {
}
},
/** Short omega format */
// eslint-disable-next-line @typescript-eslint/naming-convention
omega_short: {
config: {
greek: "\u03B2\u03B6\u03BB\u03C8\u03A3\u0398\u03A8\u03C9",
Expand Down Expand Up @@ -219,6 +220,7 @@ function decimalFormatGenerator(Decimal2) {
config: {
/** The list of elements */
/* eslint-disable prettier/prettier */
// eslint-disable-next-line @typescript-eslint/naming-convention
element_lists: [
["H"],
["He", "Li", "Be", "B", "C", "N", "O", "F"],
Expand Down Expand Up @@ -424,6 +426,7 @@ function decimalFormatGenerator(Decimal2) {
}
},
/** Old scientific format */
// eslint-disable-next-line @typescript-eslint/naming-convention
old_sc: {
/**
* Format the value into old scientific format
Expand Down Expand Up @@ -480,6 +483,7 @@ function decimalFormatGenerator(Decimal2) {
}
},
/** Mixed scientific format */
// eslint-disable-next-line @typescript-eslint/naming-convention
mixed_sc: {
/**
* Format the value into mixed scientific format (standard or scientific depending on the value)
Expand Down Expand Up @@ -894,6 +898,7 @@ function decimalFormatGenerator(Decimal2) {
ev
};
return {
// eslint-disable-next-line @typescript-eslint/naming-convention
FORMATS: FORMATS2,
formats: formats2
};
Expand Down
2 changes: 1 addition & 1 deletion dist/types/classes/SkillTree.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ declare class SkillNode implements SkillInit {
/**
* Represents a skill tree node.
* @param skill - The skill tree node to initialize.
* @param data
* @param data - The data of the skill tree node.
*/
constructor(skill: SkillInit, data?: SkillNodeData);
}
Expand Down
51 changes: 51 additions & 0 deletions eslint.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
/* eslint-disable @typescript-eslint/no-require-imports */
/* global require module */
// @ts-check

/**
* @file ESLint configuration file
*/
const eslint = require("@eslint/js");
const tseslint = require("typescript-eslint");
const eslintPluginPrettierRecommended = require("eslint-plugin-prettier/recommended");
const jsdoc = require("eslint-plugin-jsdoc");

module.exports = tseslint.config(
eslint.configs.recommended,
...tseslint.configs.strict,
...tseslint.configs.stylistic,
jsdoc.configs["flat/recommended-typescript"],
eslintPluginPrettierRecommended,

{
plugins: {
jsdoc,
},
languageOptions: {
parserOptions: {
project: "./tsconfig.eslint.json",
sourceType: "module",
ecmaVersion: "latest",
},
},
files: ["src/**/*.ts", "src/**/*.tsx"],
ignores: ["node_modules", "dist", "test"],
rules: {
"prettier/prettier": "warn",

"@typescript-eslint/no-unused-vars": "warn",
"@typescript-eslint/no-explicit-any": "warn",
"@typescript-eslint/ban-ts-comment": "warn",
"@typescript-eslint/explicit-function-return-type": "warn",
"@typescript-eslint/restrict-template-expressions": [
"warn",
{ allowNumber: true, allowBoolean: true },
],
"@typescript-eslint/consistent-type-exports": "warn",
"@typescript-eslint/consistent-type-imports": "warn",
"@typescript-eslint/naming-convention": "warn",

"jsdoc/require-file-overview": 1,
},
},
);
Loading

0 comments on commit f687ec2

Please sign in to comment.