Skip to content

v7.0.0

Compare
Choose a tag to compare
@seek-oss-ci seek-oss-ci released this 18 Jul 07:37
9850d7a

Major Changes

  • deps: tsconfig-seek 2 (#1175)

    This change sets the noUncheckedIndexedAccess compiler option to true by default.

    This will flag possible issues with indexed access of arrays and records.

    Before:

    const a: string[] = [];
    const b = a[0];
    //    ^? const b: string

    After:

    const a: string[] = [];
    const b = a[0];
    //    ^? const b: string | undefined

    Unfortunately, this change is a double edged sword as your previous code which may look like this may now be invalid.

    if (list.length === 3) {
      const b = list[1];
      //    ^? const b: string | undefined
    }

    To address this you will need to also explicitly check the index you are accessing.

    if (list.length === 3 && list[1]) {
      const b = list[1];
      //    ^? const b: string
    }

    This may seem like overkill, however, when you consider that Javascript will also allow this it may make sense

    const a: string[] = [];
    a[1000] = 'foo';
    console.log(a.length); // 1001

    Similarly with accessing records:

    const foo: Record<string, string> = {foo: 'bar'};
    
    const func = (a: string) => {
        if (foo[a]) {
            const bar = foo[a]
                // ^? const bar: string | undefined
        }
    }

    To address this you will need to pull foo[a] out into a variable as Typescript does not support type narrowing for indexed access on e[k] where k is not a literal.

    const foo: Record<string, string> = {foo: 'bar'};
    
    const func = (a: string) => {
        const b = foo[a];
        if (b) {
            const bar = b;
                // ^? const bar: string
        }
    }

    You can override this setting in your project's tsconfig.json by setting it to false.

    {
      "compilerOptions": {
        "noUncheckedIndexedAccess": false
      }
    }
  • deps: Require Node.js 18.12+ (#1206)

    Node.js 16 will reach end of life by September 2023. We have aligned our version support with sku 12.

    Consider upgrading the Node.js version for your project across:

    • .nvmrc
    • package.json#/engines/node
    • @types/node package version
    • CI/CD configuration (.buildkite/pipeline.yml, Dockerfile, etc.)

Minor Changes

  • deps: esbuild 0.18 (#1190)

    skuba build will continue to infer target from tsconfig.json at this time. See the esbuild release notes for other details.

  • format, lint: Have Prettier respect .gitignore (#1217)

    This aligns with the behaviour of the Prettier 3.0 CLI.

  • deps: TypeScript 5.1 (#1183)

    This major release includes breaking changes. See the TypeScript 5.1 announcement for more information.

  • deps: Prettier 3.0 (#1202)

    See the release notes for more information.

Patch Changes

  • template: Require Node.js 18.12+ (#1206)

  • template/oss-npm-package: Set publishConfig.provenance to true (#1182)

    See https://github.blog/2023-04-19-introducing-npm-package-provenance/ for more information.

  • template/lambda-sqs-worker: Change some info logs to debug (#1178)

    The "Function succeeded" log message was changed from info to debug to reduce the amount of unnecessary logs in production. The message will still be logged in dev environments but at a debug level.

  • tsconfig: Turn off noUnusedLocals and noUnusedParameters (#1181)

    SEEK's ESLint config has a rule which works for both function and types. We do not need both tools to do the same thing and ESLint has better support for ignoring files if needed.

  • lint: Resolve Git root before attempting to autofix (#1215)

  • configure: Resolve Git root before attempting to patch Renovate config (#1215)

  • template/lambda-sqs-worker: Bump aws-sdk-client-mock to 3.0.0 (#1197)

    AWS SDK v3.363.0 shipped with breaking type changes.