67 lines
2.5 KiB
JavaScript
67 lines
2.5 KiB
JavaScript
// This is the configuration file for ESLint, the TypeScript linter
|
|
// https://eslint.org/docs/user-guide/configuring
|
|
module.exports = {
|
|
extends: [
|
|
// The linter base is the shared IsaacScript config
|
|
// https://github.com/IsaacScript/eslint-config-isaacscript/blob/main/base.js
|
|
"eslint-config-isaacscript/base",
|
|
],
|
|
|
|
parserOptions: {
|
|
// ESLint needs to know about the project's TypeScript settings in order for TypeScript-specific
|
|
// things to lint correctly
|
|
// We do not point this at "./tsconfig.json" because certain files (such at this file) should be
|
|
// linted but not included in the actual project output
|
|
project: "./tsconfig.eslint.json",
|
|
},
|
|
|
|
rules: {
|
|
// Documentation: https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/member-ordering.md
|
|
// We want class and interface definitions to be alphabetically ordered so that they match the
|
|
// Isaac documentation
|
|
"@typescript-eslint/member-ordering": [
|
|
"warn",
|
|
{
|
|
default: {
|
|
order: "alphabetically",
|
|
},
|
|
|
|
interfaces: {
|
|
memberTypes: ["method", "field"],
|
|
order: "alphabetically",
|
|
},
|
|
},
|
|
],
|
|
|
|
// Documentation:
|
|
// https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/triple-slash-reference.md
|
|
// Defined at:
|
|
// https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/src/configs/recommended.ts
|
|
// ark120202, the author of TypeScriptToLua, recommends using triple-slash directives
|
|
"@typescript-eslint/triple-slash-reference": "off",
|
|
|
|
// Documentation:
|
|
// https://github.com/eslint/eslint/blob/master/docs/rules/no-bitwise.md
|
|
// Defined at:
|
|
// https://github.com/airbnb/javascript/blob/master/packages/eslint-config-airbnb-base/rules/style.js
|
|
// Isaac enums use bitwise operators (e.g. "EntityFlag")
|
|
"no-bitwise": "off",
|
|
|
|
// Documentation:
|
|
// https://eslint.org/docs/rules/no-underscore-dangle
|
|
// Defined at:
|
|
// https://github.com/airbnb/javascript/blob/master/packages/eslint-config-airbnb-base/rules/style.js
|
|
// We keep the Airbnb specification but allow calling functions that overload Lua operators:
|
|
// https://moddingofisaac.com/docs/class_vector.html
|
|
"no-underscore-dangle": [
|
|
"error",
|
|
{
|
|
allow: ["__add", "__sub", "__mul", "__div", "__unm", "__len"],
|
|
allowAfterThis: false,
|
|
allowAfterSuper: false,
|
|
enforceInMethodNames: true,
|
|
},
|
|
],
|
|
},
|
|
};
|