Skip to content

Commit

Permalink
sort imports with eslint plugin
Browse files Browse the repository at this point in the history
  • Loading branch information
ebisbe committed Jul 7, 2024
1 parent 54a3308 commit 515910f
Show file tree
Hide file tree
Showing 7 changed files with 110 additions and 18 deletions.
19 changes: 14 additions & 5 deletions eslint.config.mjs
Original file line number Diff line number Diff line change
@@ -1,11 +1,20 @@
import globals from "globals";
import pluginJs from "@eslint/js";
import eslintPluginPrettierRecommended from "eslint-plugin-prettier/recommended";
import simpleImportSort from "eslint-plugin-simple-import-sort";
import globals from "globals";
import tseslint from "typescript-eslint";


export default [
{files: ["**/*.{js,mjs,cjs,ts}"]},
{languageOptions: { globals: globals.browser }},
{ files: ["**/*.{js,mjs,cjs,ts}"] },
{ languageOptions: { globals: globals.browser } },
pluginJs.configs.recommended,
eslintPluginPrettierRecommended,
...tseslint.configs.recommended,
];
{
plugins: { "simple-import-sort": simpleImportSort },
rules: {
"simple-import-sort/imports": "error",
"simple-import-sort/exports": "error",
},
},
];
14 changes: 7 additions & 7 deletions jest.config.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* https://jestjs.io/docs/configuration
*/

const esModules = ["@middy"].join("|")
const esModules = ["@middy"].join("|");

/** @type {import('jest').Config} */
const config = {
Expand Down Expand Up @@ -103,9 +103,9 @@ const config = {
// notifyMode: "failure-change",

// A preset that is used as a base for Jest's configuration
preset: 'ts-jest',
preset: "ts-jest",

extensionsToTreatAsEsm: ['.ts'],
extensionsToTreatAsEsm: [".ts"],

// Run tests from one or more projects
// projects: undefined,
Expand Down Expand Up @@ -137,7 +137,7 @@ const config = {
// runner: "jest-runner",

// The paths to modules that run some code to configure or set up the testing environment before each test
setupFiles: ['dotenv/config'],
setupFiles: ["dotenv/config"],

// A list of paths to modules that run some code to configure or set up the testing framework before each test
// setupFilesAfterEnv: [],
Expand Down Expand Up @@ -182,9 +182,9 @@ const config = {
"^.+\\.ts?$": [
"ts-jest",
{
useESM: true
}
]
useESM: true,
},
],
},

// An array of regexp pattern strings that are matched against all source file paths, matched files will skip transformation
Expand Down
3 changes: 3 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,9 @@
"@types/serverless": "^3.12.22",
"dotenv": "^16.4.5",
"eslint": "9.x",
"eslint-config-prettier": "^9.1.0",
"eslint-plugin-prettier": "^5.1.3",
"eslint-plugin-simple-import-sort": "^12.1.1",
"globals": "^15.8.0",
"jest": "^29.7.0",
"prettier": "3.3.2",
Expand Down
79 changes: 79 additions & 0 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion src/functions/list/__tests__/create.test.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { describe, it, expect } from "@jest/globals";
import { describe, expect, it } from "@jest/globals";

import { handler } from "../create";

describe("CREATE List", () => {
Expand Down
7 changes: 4 additions & 3 deletions src/functions/list/create.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
import { Handler, APIGatewayProxyEventV2 } from "aws-lambda";
import { List } from "../../models/table";
import { z } from "zod";
import middy from "@middy/core";
import httpErrorHandler from "@middy/http-error-handler";
import httpJsonBodyParser from "@middy/http-json-body-parser";
import { APIGatewayProxyEventV2, Handler } from "aws-lambda";
import { z } from "zod";

import { List } from "../../models/table";
import { HttpError } from "../../utils/httpError";
import { ValidationError } from "../../utils/validationError";

Expand Down
3 changes: 1 addition & 2 deletions src/models/table.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import { Entity, Table } from "dynamodb-onetable";

import { DynamoDBClient } from "@aws-sdk/client-dynamodb";
import { Entity, Table } from "dynamodb-onetable";
const client = new DynamoDBClient();

const { ddb_table } = process.env;
Expand Down

0 comments on commit 515910f

Please sign in to comment.