@autobe/compiler 0.16.1 → 0.18.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -39,7 +39,7 @@ export const writeRealizeControllers = async (
39
39
  const auth: AutoBeRealizeAuthorization | undefined =
40
40
  operate.authorizationRole
41
41
  ? props.authorizations.find(
42
- (d) => d.role === operate.authorizationRole,
42
+ (d) => d.role.name === operate.authorizationRole,
43
43
  )
44
44
  : undefined;
45
45
  if (operate.authorizationRole && auth === undefined) return method; // unreachable
@@ -105,7 +105,7 @@ export const writeRealizeControllers = async (
105
105
  ),
106
106
  ],
107
107
  undefined,
108
- auth.role,
108
+ auth.role.name,
109
109
  undefined,
110
110
  ts.factory.createTypeReferenceNode(
111
111
  ctx.importer.external({
@@ -1,6 +1,5 @@
1
- import sortImport from "@trivago/prettier-plugin-sort-imports";
2
- import import2 from "import2";
3
- import { format } from "prettier";
1
+ import { ESLint } from "eslint";
2
+ import ImportOrderPlugin from "eslint-plugin-perfectionist";
4
3
  import ts from "typescript";
5
4
 
6
5
  export namespace FilePrinter {
@@ -41,14 +40,14 @@ export namespace FilePrinter {
41
40
 
42
41
  export const beautify = async (script: string): Promise<string> => {
43
42
  try {
44
- return await format(script, {
45
- parser: "typescript",
46
- plugins: [sortImport, await import2("prettier-plugin-jsdoc")],
47
- importOrder: ["<THIRD_PARTY_MODULES>", "^[./]"],
48
- importOrderSeparation: true,
49
- importOrderSortSpecifiers: true,
50
- importOrderParserPlugins: ["decorators-legacy", "typescript", "jsx"],
43
+ const lint = new ESLint({
44
+ fix: true,
45
+ plugins: {
46
+ ImportOrderPlugin,
47
+ },
51
48
  });
49
+ const results = await lint.lintText(script).then((v) => v.at(0));
50
+ return results?.output ?? script;
52
51
  } catch {
53
52
  return script;
54
53
  }