Skip to content

Freshly generated project for CF on TypeScript following official guide contains lots of eslint's violations #472

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
evil-shrike opened this issue Aug 22, 2022 · 0 comments · Fixed by #489
Assignees

Comments

@evil-shrike
Copy link

Hi,

I followed the guide for creating a CF using TypeScript.
I suppose it's an official guide how to build CFs using TypeScript.
It uses gts for a project. And local .eslintrc.json refers to one in gts:

.eslintrc.json

{
  "extends": "./node_modules/gts/"
}

The problem is that if we run gts lint or open the project in VSCode we'll see tons of errors.
And it's just in default freshly generated according an official guide project.
Particularly any CF project will have this line:

import type {HttpFunction} from '@google-cloud/functions-framework/build/src/functions';

and eslint complains about it:
"@google-cloud/functions-framework" is not published.

If we want to add typing for request/response we'll import import express from 'express'; which installed as a dev-dependency @types/express. Again it will cause a violation from eslint: "no-extraneous-import".

So I don't quite understand how it's suppose to work. We got a lint tool for free (gts/eslint) with some default config but it doesn't work even in empty project.

Can you please consider providing a working bootstrapping setup for TypeScript-based projects for CFs.
Thanks.

matthewrobertson added a commit that referenced this issue Nov 18, 2022
This was very out of date. Updated to reflect most recent version of the
FF.

fixes #472, #469
matthewrobertson added a commit that referenced this issue Nov 19, 2022
This was very out of date. Updated to reflect most recent version of the
FF.

fixes #472, #469
matthewrobertson added a commit that referenced this issue Nov 19, 2022
This was very out of date. Updated to reflect most recent version of the
FF.

fixes #472, #469
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants