Version 0.16.0 of the
@kensio/yulin
package adds ESLint config and typing support for CloudFront Functions JS2 syntax.
CloudFront Functions types in JavaScript / JS2 files:
/**
* @typedef {import("@kensio/yulin/cloudfront").CloudFrontFunction.Event} CloudFrontEvent
* @typedef {import("@kensio/yulin/cloudfront").CloudFrontFunction.Request} CloudFrontRequest
* @typedef {import("@kensio/yulin/cloudfront").CloudFrontFunction.Response} CloudFrontResponse
*/
CloudFront Functions types in TypeScript files:
import { type CloudFrontFunction } from "@kensio/yulin/cloudfront";
const event: CloudFrontFunction.Event = {
// ...
};
CloudFront Functions JS2 syntax ESLint config in eslint.config.ts:
import { defineConfig } from "eslint/config";
import tseslint from "typescript-eslint";
import { cloudFrontFunctionsJs2 } from "@kensio/yulin/eslint";
export default defineConfig(
...tseslint.configs.recommended,
...cloudFrontFunctionsJs2,
);
Then you can work on CFF JS2 in .cff.js files with some basic typing and ESLint support.