Skip to content

Commit

Permalink
chore: update to eslint 9 (#1922)
Browse files Browse the repository at this point in the history
* chore: update to eslint9

* fix lint issues

* Undo code change
  • Loading branch information
domoritz committed Apr 16, 2024
1 parent c9c2a19 commit 72db67f
Show file tree
Hide file tree
Showing 186 changed files with 1,550 additions and 1,250 deletions.
23 changes: 0 additions & 23 deletions .editorconfig

This file was deleted.

3 changes: 0 additions & 3 deletions .eslintignore

This file was deleted.

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

This file was deleted.

9 changes: 5 additions & 4 deletions .vscode/settings.json
@@ -1,17 +1,18 @@
// Place your settings in this file to overwrite default and user settings.
{
"search.exclude": {
"dist": true,
"bin": true
"dist": true
},
"files.trimTrailingWhitespace": true,
"typescript.tsdk": "node_modules/typescript/lib",
"files.insertFinalNewline": true,
"eslint.validate": ["javascript", "javascriptreact", "typescript", "typescriptreact"],
"eslint.validate": ["javascript", "javascriptreact", "typescript"],
"editor.tabSize": 4,
"editor.formatOnSave": true,
"editor.codeActionsOnSave": {
"source.fixAll.eslint": "explicit"
},
"jest.autoRun": "off"
"eslint.experimental.useFlatConfig": true,
"jest.runMode": "on-demand",
"javascript.preferences.importModuleSpecifierEnding": "js"
}
File renamed without changes.
2 changes: 1 addition & 1 deletion bin/ts-json-schema-generator
@@ -1,2 +1,2 @@
#!/usr/bin/env node
require('../dist/ts-json-schema-generator');
import("../dist/ts-json-schema-generator.js");
78 changes: 78 additions & 0 deletions eslint.config.js
@@ -0,0 +1,78 @@
import eslint from "@eslint/js";
import globals from "globals";
import tseslint from "typescript-eslint";
import eslintPluginPrettierRecommended from "eslint-plugin-prettier/recommended";

/** @type {import('@types/eslint').Linter.FlatConfig[]} */
export default tseslint.config(
{
ignores: ["dist"],
},
eslint.configs.recommended,
{
files: [
"ts-json-schema-generator.ts",
"index.ts",
"src/**/*.ts",
"factory/**/*.ts",
"bin/**",
"test/**/*.test.ts",
"test/utils.ts",
],
extends: tseslint.configs.recommendedTypeChecked,
languageOptions: {
sourceType: "module",
parserOptions: {
project: "tsconfig.eslint.json",
tsconfigRootDir: import.meta.dirname,
},
},
rules: {
"@typescript-eslint/explicit-function-return-type": "off",
"@typescript-eslint/no-explicit-any": "off",
"@typescript-eslint/prefer-for-of": "error",
"@typescript-eslint/no-require-imports": "error",
"@typescript-eslint/no-parameter-properties": "off",
"no-unused-vars": "off",
"@typescript-eslint/no-unused-vars": [
"error",
{
vars: "all",
args: "none",
ignoreRestSiblings: true,
},
],
"@typescript-eslint/no-object-literal-type-assertion": "off",
"@typescript-eslint/no-namespace": "error",
"@typescript-eslint/no-non-null-assertion": "off",
"@typescript-eslint/no-unsafe-assignment": "warn",
"@typescript-eslint/no-unsafe-member-access": "warn",
"@typescript-eslint/no-unsafe-return": "warn",
"@typescript-eslint/no-unsafe-argument": "warn",
"@typescript-eslint/no-unsafe-call": "warn",
"@typescript-eslint/no-floating-promises": "off",
"@typescript-eslint/no-unnecessary-type-assertion": "warn",
"no-alert": "error",
"prefer-const": "error",
"no-return-assign": "error",
"no-useless-call": "error",
"no-shadow": "error",
"no-useless-concat": "error",
"no-undef": "off",
"no-prototype-builtins": "off",
},
},
{
files: ["*.js"],
...tseslint.configs.disableTypeChecked,
},
{
files: ["test/**/*.test.ts"],
languageOptions: {
globals: {
...globals.jest,
},
},
},
eslintPluginPrettierRecommended
);
66 changes: 33 additions & 33 deletions factory/formatter.ts
@@ -1,36 +1,36 @@
import { ChainTypeFormatter } from "../src/ChainTypeFormatter";
import { CircularReferenceTypeFormatter } from "../src/CircularReferenceTypeFormatter";
import { CompletedConfig } from "../src/Config";
import { MutableTypeFormatter } from "../src/MutableTypeFormatter";
import { TypeFormatter } from "../src/TypeFormatter";
import { AliasTypeFormatter } from "../src/TypeFormatter/AliasTypeFormatter";
import { AnnotatedTypeFormatter } from "../src/TypeFormatter/AnnotatedTypeFormatter";
import { AnyTypeFormatter } from "../src/TypeFormatter/AnyTypeFormatter";
import { ArrayTypeFormatter } from "../src/TypeFormatter/ArrayTypeFormatter";
import { BooleanTypeFormatter } from "../src/TypeFormatter/BooleanTypeFormatter";
import { ConstructorTypeFormatter } from "../src/TypeFormatter/ConstructorTypeFormatter";
import { DefinitionTypeFormatter } from "../src/TypeFormatter/DefinitionTypeFormatter";
import { EnumTypeFormatter } from "../src/TypeFormatter/EnumTypeFormatter";
import { FunctionTypeFormatter } from "../src/TypeFormatter/FunctionTypeFormatter";
import { HiddenTypeFormatter } from "../src/TypeFormatter/HiddenTypeFormatter";
import { IntersectionTypeFormatter } from "../src/TypeFormatter/IntersectionTypeFormatter";
import { LiteralTypeFormatter } from "../src/TypeFormatter/LiteralTypeFormatter";
import { LiteralUnionTypeFormatter } from "../src/TypeFormatter/LiteralUnionTypeFormatter";
import { NeverTypeFormatter } from "../src/TypeFormatter/NeverTypeFormatter";
import { NullTypeFormatter } from "../src/TypeFormatter/NullTypeFormatter";
import { NumberTypeFormatter } from "../src/TypeFormatter/NumberTypeFormatter";
import { ObjectTypeFormatter } from "../src/TypeFormatter/ObjectTypeFormatter";
import { OptionalTypeFormatter } from "../src/TypeFormatter/OptionalTypeFormatter";
import { PrimitiveUnionTypeFormatter } from "../src/TypeFormatter/PrimitiveUnionTypeFormatter";
import { ReferenceTypeFormatter } from "../src/TypeFormatter/ReferenceTypeFormatter";
import { RestTypeFormatter } from "../src/TypeFormatter/RestTypeFormatter";
import { StringTypeFormatter } from "../src/TypeFormatter/StringTypeFormatter";
import { SymbolTypeFormatter } from "../src/TypeFormatter/SymbolTypeFormatter";
import { TupleTypeFormatter } from "../src/TypeFormatter/TupleTypeFormatter";
import { UndefinedTypeFormatter } from "../src/TypeFormatter/UndefinedTypeFormatter";
import { UnionTypeFormatter } from "../src/TypeFormatter/UnionTypeFormatter";
import { UnknownTypeFormatter } from "../src/TypeFormatter/UnknownTypeFormatter";
import { VoidTypeFormatter } from "../src/TypeFormatter/VoidTypeFormatter";
import { ChainTypeFormatter } from "../src/ChainTypeFormatter.js";
import { CircularReferenceTypeFormatter } from "../src/CircularReferenceTypeFormatter.js";
import { CompletedConfig } from "../src/Config.js";
import { MutableTypeFormatter } from "../src/MutableTypeFormatter.js";
import { TypeFormatter } from "../src/TypeFormatter.js";
import { AliasTypeFormatter } from "../src/TypeFormatter/AliasTypeFormatter.js";
import { AnnotatedTypeFormatter } from "../src/TypeFormatter/AnnotatedTypeFormatter.js";
import { AnyTypeFormatter } from "../src/TypeFormatter/AnyTypeFormatter.js";
import { ArrayTypeFormatter } from "../src/TypeFormatter/ArrayTypeFormatter.js";
import { BooleanTypeFormatter } from "../src/TypeFormatter/BooleanTypeFormatter.js";
import { ConstructorTypeFormatter } from "../src/TypeFormatter/ConstructorTypeFormatter.js";
import { DefinitionTypeFormatter } from "../src/TypeFormatter/DefinitionTypeFormatter.js";
import { EnumTypeFormatter } from "../src/TypeFormatter/EnumTypeFormatter.js";
import { FunctionTypeFormatter } from "../src/TypeFormatter/FunctionTypeFormatter.js";
import { HiddenTypeFormatter } from "../src/TypeFormatter/HiddenTypeFormatter.js";
import { IntersectionTypeFormatter } from "../src/TypeFormatter/IntersectionTypeFormatter.js";
import { LiteralTypeFormatter } from "../src/TypeFormatter/LiteralTypeFormatter.js";
import { LiteralUnionTypeFormatter } from "../src/TypeFormatter/LiteralUnionTypeFormatter.js";
import { NeverTypeFormatter } from "../src/TypeFormatter/NeverTypeFormatter.js";
import { NullTypeFormatter } from "../src/TypeFormatter/NullTypeFormatter.js";
import { NumberTypeFormatter } from "../src/TypeFormatter/NumberTypeFormatter.js";
import { ObjectTypeFormatter } from "../src/TypeFormatter/ObjectTypeFormatter.js";
import { OptionalTypeFormatter } from "../src/TypeFormatter/OptionalTypeFormatter.js";
import { PrimitiveUnionTypeFormatter } from "../src/TypeFormatter/PrimitiveUnionTypeFormatter.js";
import { ReferenceTypeFormatter } from "../src/TypeFormatter/ReferenceTypeFormatter.js";
import { RestTypeFormatter } from "../src/TypeFormatter/RestTypeFormatter.js";
import { StringTypeFormatter } from "../src/TypeFormatter/StringTypeFormatter.js";
import { SymbolTypeFormatter } from "../src/TypeFormatter/SymbolTypeFormatter.js";
import { TupleTypeFormatter } from "../src/TypeFormatter/TupleTypeFormatter.js";
import { UndefinedTypeFormatter } from "../src/TypeFormatter/UndefinedTypeFormatter.js";
import { UnionTypeFormatter } from "../src/TypeFormatter/UnionTypeFormatter.js";
import { UnknownTypeFormatter } from "../src/TypeFormatter/UnknownTypeFormatter.js";
import { VoidTypeFormatter } from "../src/TypeFormatter/VoidTypeFormatter.js";

export type FormatterAugmentor = (
formatter: MutableTypeFormatter,
Expand Down
10 changes: 5 additions & 5 deletions factory/generator.ts
@@ -1,8 +1,8 @@
import { Config, DEFAULT_CONFIG } from "../src/Config";
import { SchemaGenerator } from "../src/SchemaGenerator";
import { createFormatter } from "./formatter";
import { createParser } from "./parser";
import { createProgram } from "./program";
import { Config, DEFAULT_CONFIG } from "../src/Config.js";
import { SchemaGenerator } from "../src/SchemaGenerator.js";
import { createFormatter } from "./formatter.js";
import { createParser } from "./parser.js";
import { createProgram } from "./program.js";

export function createGenerator(config: Config): SchemaGenerator {
const completedConfig = { ...DEFAULT_CONFIG, ...config };
Expand Down
8 changes: 4 additions & 4 deletions factory/index.ts
@@ -1,4 +1,4 @@
export * from "./formatter";
export * from "./generator";
export * from "./parser";
export * from "./program";
export * from "./formatter.js";
export * from "./generator.js";
export * from "./parser.js";
export * from "./program.js";

0 comments on commit 72db67f

Please sign in to comment.