npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@josundt/tsconfig-rules

v5.2.2

Published

Common TypeScript compiler rules for all josundt projects

Downloads

7

Readme

@josundt/tsconfig-rules

CHANGES:

  • v5.2.x: Change lib from ES2019 to ES2022, target from ES2019 to ES2021 for both Web and Node

  • V4.7.x: Use module/moduleResolution NodeNext for tsconfig.base.json

  • V4.7.x: target ES2019 for web projects

  • V4.5.x: Removed ES5 configs

  • V4.5.x: "esModuleInterop": true is set to default for better ES Module interoperability.
    NB! node_modules namespace import syntax must be changed from...

    import * as foo from "my-package";

    ...to...

    import foo from "my-package";
  • v4.3.x: Added "noImplicitOverride": true (to all rules).
    When extending a super class and overriding methods or fields, the new TS 4.3 override keyword is required.

  • v4.2.x: Added "noPropertyAccessFromIndexSignature": true (to all rules).
    Index signature objects like Record<string, T> now need to use square bracket notation:
    myRecord["prop"]
    ...instead of dot notation:
    myRecord.prop

  • v3.8.x: Compile everything to ES2017 (for Node ES2019)

Contains the standard base compiler options/rules to be used in all TypeScript source code in different projects.

Add this package as a dependency of your project, and ensure that your project's tsconfig.json file extends the appropriate file based on your project type:

PS! These compiler settings require that you have added the "tslib" package added as a development depdency of your project.

Web projects

A - For webpack projects

For web projects with Webpack:
In the top of your project's tsconfig.json file, add:

{
    "extends": "./node_modules/@josundt/tsconfig-rules/tsconfig.base.web.esm.json"
}

B - AMD projects

In the top of your project's tsconfig.json file, add:

{
    "extends": "./node_modules/@josundt/tsconfig-rules/tsconfig.base.web.amd.json"
}

NPM package projects - multi-targeting

When building multi-targeting npm packages, we commonly compile 3 different versions, with different entry point references in the package.json of the npm package:

  1. ES5 target with UMD modules
    Works in both node and web, and the compiled entrypoint file path is set in the npm package's main property in package.json:
{
    "extends": "./node_modules/@josundt/tsconfig-rules/tsconfig.base.es5.umd.json"
}
  1. ES5 target with ES modules Compiles to ES5 but uses ES2017 module import syntax. The compiled entrypoint file path is set in the npm package's module property in package.json. PS! Webpack prefers this entrypoint (module instead of main) in the bundle module dependency crawler:
{
    "extends": "./node_modules/@josundt/tsconfig-rules/tsconfig.base.web.esm.json"
}
  1. ES2017 target with ES modules Compiles to ES2017 and uses ES2017 module import syntax. The compiled entrypoint file path is set in the npm package's ES2017 property in package.json. This is for future fully ES2017 and ES2017 modules compliant browsers/node engines.*
{
    "extends": "./node_modules/@josundt/tsconfig-rules/tsconfig.base.es2017.esm.json"
}

Node projects

In your project's tsconfig.json file:

{
    "extends": "./node_modules/@josundt/tsconfig-rules/tsconfig.base.node.json"
}