Git Product home page Git Product logo

Comments (3)

jeluard avatar jeluard commented on July 17, 2024

consistent-type-imports/ and consistent-type-exports/ rules do address this. Their usage is detailed on elsint blog.

Applying them on lodestar code base produces the following result:

✖ 3176 problems (3114 errors, 62 warnings)
  3104 errors and 0 warnings potentially fixable with the `--fix` option.

Most of those errors can be fixed by eslint. Evenso the number of files impacted is huge, it might still be woth doing for the following reasons:

  • do not depend on import side-effects for proper behavior
  • allow tree-shaker to remove unneeded code (and reduce bundle sizes)

from lodestar.

wemeetagain avatar wemeetagain commented on July 17, 2024

I'm in favor of adding these linter rules 👍

  • Also linking this other issue, #6011, since a nice endgame would be to have consistent rules across all our maintained repos.

from lodestar.

nflaig avatar nflaig commented on July 17, 2024

it might still be woth doing for the following reasons:

Looking at some examples in our code

import type {FastifyInstance} from "fastify";

It does not look like it make any difference as tsc is smart enough already to remove if from if only used as a type (I'd assume same applies for other bundlers)

Note that we already have import/no-extraneous-dependencies which prevents you from using fastify as a value in the api package as it is only a dev dependency.

I am not fully convinced that type imports are that useful in most cases, do we have an example in Lodestar were this makes a difference? As far as I can see the change from normal to type imports in #6384 does not matter

Not against adding these rules but we should have at least one specific case were a lint rule would have saved us before adding it.

from lodestar.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.