Giter VIP home page Giter VIP logo

bases's People

Contributors

acidoxee avatar acrylicshrimp avatar akira-toriyama avatar andrewbranch avatar arniu avatar chasewalden avatar chriskrycho avatar dummdidumm avatar einhund avatar ertantaner avatar hnordt avatar hyperupcall avatar jonahsnider avatar kachick avatar kaznovac avatar kidonng avatar mataha avatar merelinguist avatar mgcrea avatar nickgerleman avatar nullvoxpopuli avatar orta avatar paleite avatar phuctm97 avatar retyui avatar robintail avatar slorber avatar smorimoto avatar yinm avatar zanminkian avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

bases's Issues

a single package with all the tsconfig

this will be very helpful in a monorepo situation, instead of installing different config for vite, node, next ....
just a single package with all the configs.

Change Node 16 moduleResolution to "Node16"

Issue

Current moduleResolution value is "node". This doesn't seem to support "exports" in package.json.

Possible Solution

Change moduleResolution to "Node16" seems appropriate. A quick test overriding the value after extending this configuration seems to solve the issue.

Add Angular tsconfig template

Looks like this is the default: https://angular.io/guide/typescript-configuration

{
  "compileOnSave": false,
  "compilerOptions": {
    "baseUrl": "./",
    "outDir": "./dist/out-tsc",
    "sourceMap": true,
    "declaration": false,
    "downlevelIteration": true,
    "experimentalDecorators": true,
    "moduleResolution": "node",
    "importHelpers": true,
    "target": "es2015",
    "module": "es2020",
    "lib": [
      "es2018",
      "dom"
    ]
  }
}

typescript @ alias not work bug

typescript @ alias not work

Cannot find module '@/components/' or its corresponding type declarations.ts

image

tsconfig.json

{
  "compilerOptions": {
    "target": "es5",
    "lib": [
      "dom",
      "dom.iterable",
      "esnext"
    ],
    "allowJs": true,
    "skipLibCheck": true,
    "esModuleInterop": true,
    "allowSyntheticDefaultImports": true,
    "strict": true,
    "forceConsistentCasingInFileNames": true,
    "noFallthroughCasesInSwitch": true,
    "module": "esnext",
    "moduleResolution": "node",
    "resolveJsonModule": true,
    "isolatedModules": true,
    "noEmit": false,
    "jsx": "react",
    "outDir": "./dist/",
    "baseUrl": ".",
    "paths": {
      "@/*": ["./src/*"],
      "@/components/*": ["./src/components/*"],
    },
  },
  "include": [
    "./src/**/*",
  ]
}

Is "es2021" target/lib valid?

I daily run Node 16 so it is natural that when creating new projects, one of the first things I do is yarn add --dev @tsconfig/node16.

This does however present an issue; the node16 tsconfig contains es2021 as it's "target" and "lib" which causes TypeScript to scream at me both within my IDE (VS Code) and upon compiling my project.

I assumed I had an old version of typescript installed or similar but upon checking the Official Documentation, I have discovered that es2021 is not actually a valid property.

Should this become ESNext instead until ES2021 is supported?

Also, as a side note, all of the configs currently specify the ECMA version in lowercase (es2020), whilst the documentation uses uppercase (ES2020); these should probably be updated to follow the documentation.

create-react-app: post-ie11 world

With Internet Explorer 11 support ended what does this mean for what version of ES we can target for web applications created through create-react-app?

I am looking forward to being able to use async generators, etc. without high transpilations once they are natively supported by all of my target platforms. ๐Ÿ˜„

Add Next.js base

Based on the list of available and omitted polyfills, a base config could be made for Next.js projects. This would make sure that no compatibility issues arise during runtime in older browsers.

Importing json on `"module": "NodeNext"` with `assert { type: 'json' }`

I want to import json file and use NodeNext module configurations:

For Node users using my lib I need to add assert { type: 'json' }
But when I use "module": "NodeNext", an import like that:

import isracardCardsTransactionsList from '../schemas/isracardCardsTransactionsList.json' assert { type: 'json' };

I get an error: error TS2836: Import assertions are not allowed on statements that transpile to commonjs 'require' calls.

When I go back to "module": "ESNext" it works.

What do you think would be the right configurations?

P.S. this is the repo: https://github.com/Urigo/israeli-bank-scrapers-modern-schemas

Refactor due to "extends": [] Array support

tsconfig.json files will soon support arrays inside the "extends" key:
microsoft/TypeScript#29118

I'd imagine this will simplify this project a lot, and make creating typescript configurations much more expressive.

I believe it may be best to re-imagine tsconfig/bases given this new TS feature. I can't imagine migrating from the non-array based setup would be hard. Existing packages would still exist as published, but wouldn't receive any new updates (do they need to be updated?).

hype train: https://twitter.com/DevinRhode2/status/1602790036050681858

Consider adding a transitional config

For non-greenfields projects, it would be useful to allow the mixing of JavaScript and TypeScript as a codebase is moved from one to the other. tsconfig does allow for this via allowJs and checkJs

For example:

{
  "extends": "@tsconfig/recommended/tsconfig.json",
  "compilerOptions": {
    "allowJs": true,
    "checkJs": true,
    "outDir": "build"
  },
  "includes": ["src"]
}

node.js ERR_IMPORT_ASSERTION_TYPE_MISSING TypeError: Module tsconfig.json needs an import assertion of type "json"

{
    "extends": "../../tsconfig.json",
    "include": [
        "**/*.ts"
    ],
    "exclude": [
        "node_modules", 
        "build"
    ],
    "compilerOptions": {
        "baseUrl": ".",
        "rootDir": ".",
        "outDir": "build/",
        "plugins": [
            {
                "name": "@rollup/plugin-typescript"
            },
            {
                "name": "@rollup/plugin-json"
            }
        ]
    }
}

bumps into the following build error:

[!] TypeError: Module "file:///usr/src/Node.JSRestAPI/src/core/tsconfig.json" needs an import assertion of type "json"
TypeError [ERR_IMPORT_ASSERTION_TYPE_MISSING]: Module "file:///usr/src/Node.JSRestAPI/src/core/tsconfig.json" needs an import assertion of type "json"
    at new NodeError (node:internal/errors:393:5)
    at validateAssertions (node:internal/modules/esm/assert:82:15)
    at defaultLoad (node:internal/modules/esm/load:84:3)
    at nextLoad (node:internal/modules/esm/loader:164:28)
    at ESMLoader.load (node:internal/modules/esm/loader:603:26)
    at ESMLoader.moduleProvider (node:internal/modules/esm/loader:459:22)
    at new ModuleJob (node:internal/modules/esm/module_job:63:26)
    at #createModuleJob (node:internal/modules/esm/loader:478:17)
    at ESMLoader.getModuleJob (node:internal/modules/esm/loader:436:34)
    at async ModuleWrap.<anonymous> (node:internal/modules/esm/module_job:78:21)

I have set "resolveJsonModule": true, in top-level tsconfig.json

Combined bases not resolvable via npm

Self-explanatory; the following:

npm install --save-dev "@tsconfig/node16-strictest"

results in:

npm ERR! code E404
npm ERR! 404 Not Found - GET https://registry.npmjs.org/@tsconfig%2fnode16-strictest - Not found
npm ERR! 404
npm ERR! 404  '@tsconfig/node16-strictest@*' is not in this registry.
npm ERR! 404 You should bug the author to publish it (or use the name yourself!)
npm ERR! 404
npm ERR! 404 Note that you can also install from a
npm ERR! 404 tarball, folder, http url, or git url.

npm ERR! A complete log of this run can be found in:
npm ERR!     C:\Users\user\AppData\Local\npm-cache\_logs\2022-02-15T00_39_37_612Z-debug.log

Are these not published to npm, or is extending them via node_modules going to be the intended usage?

Add node-lts to bases

It seems it would be quite helpful to have a base that maps to node lts (at current 16.13.0 to 16.X). An example were it could be used in in Github Actions where one can always target node lts as follows.

name: Setup
description: Setup pnpm, Node and install dependencies
runs:
  using: composite
  steps:
    - name: Install pnpm
      uses: pnpm/action-setup@v2
      with:
        version: 7

    - name: Install Node.js
      uses: actions/setup-node@v3
      with:
        node-version: "lts/*"

    - name: Install NPM packages
      run: pnpm install
      shell: bash

The key here is node-version: "lts/*" which as one would guess will always be the latest lts. Therefore in our code it would be nice to create a base tsconfig that extends from a tsconfig base current lts. At the time of this issue the current lts is 16.18.0 so one could either copy the current node-16 bases and start new set or maybe script a way to publish whatever the current lts mapping is and publish as node-lts then there would be only one set to manage.

puppeteer config

Maybe puppeteer is just node scripts, but maybe it's not quite that simple?

Could definitely take advantage of top level await

React Native: Type 'Timeout' is not assignable to type 'number'

Reproduce:

npx react-native init MyApp --template react-native-template-typescript
cd MyApp
yarn add --dev @tsconfig/react-native
# update 

tsconfig.json

{
  "extends": "@tsconfig/react-native/tsconfig.json"
}

The issue:

001


`yarn why @types/node`
yarn why v1.22.17
[1/4] Why do we have the module "@types/node"...?
[2/4] Initialising dependency graph...
[3/4] Finding dependency...
[4/4] Calculating file sizes...
=> Found "@types/[email protected]"
info Reasons this module exists
   - "@jest#types" depends on it
   - Hoisted from "@jest#types#@types#node"
   - Hoisted from "jest-haste-map#@types#node"
   - Hoisted from "jest-util#@types#node"
   - Hoisted from "jest-worker#@types#node"
   - Hoisted from "jest#@jest#core#@types#node"
   - Hoisted from "jest-haste-map#@types#graceful-fs#@types#node"
   - Hoisted from "jest-haste-map#jest-serializer#@types#node"
   - Hoisted from "jest#@jest#core#@jest#console#@types#node"
   - Hoisted from "react-native#@jest#create-cache-key-function#@jest#types#@types#node"
   - Hoisted from "jest#@jest#core#jest-runner#@types#node"
   - Hoisted from "jest#@jest#core#jest-watcher#@types#node"
   - Hoisted from "jest#@jest#core#jest-runner#@jest#environment#@types#node"
   - Hoisted from "jest#@jest#core#jest-runtime#@jest#fake-timers#@types#node"
   - Hoisted from "jest#@jest#core#jest-config#jest-environment-jsdom#@types#node"
   - Hoisted from "jest#@jest#core#jest-config#jest-environment-node#@types#node"
   - Hoisted from "jest#@jest#core#jest-config#jest-jasmine2#@types#node"
   - Hoisted from "jest#@jest#core#jest-runtime#jest-mock#@types#node"
   - Hoisted from "react-native#@react-native-community#cli#@react-native-community#cli-plugin-metro#metro-core#jest-haste-map#@types#node"
   - Hoisted from "react-native#@react-native-community#cli#@react-native-community#cli-plugin-metro#metro#jest-haste-map#@types#node"
   - Hoisted from "react-native#@react-native-community#cli#@react-native-community#cli-plugin-metro#metro-core#jest-haste-map#@jest#types#@types#node"
   - Hoisted from "react-native#@react-native-community#cli#@react-native-community#cli-plugin-metro#metro#jest-haste-map#@jest#types#@types#node"
   - Hoisted from "react-native#@react-native-community#cli#@react-native-community#cli-plugin-metro#metro-core#jest-haste-map#jest-serializer#@types#node"
   - Hoisted from "react-native#@react-native-community#cli#@react-native-community#cli-plugin-metro#metro#jest-haste-map#jest-serializer#@types#node"
   - Hoisted from "react-native#@react-native-community#cli#@react-native-community#cli-plugin-metro#metro-core#jest-haste-map#jest-util#@types#node"
   - Hoisted from "react-native#@react-native-community#cli#@react-native-community#cli-plugin-metro#metro#jest-haste-map#jest-util#@types#node"
   - Hoisted from "react-native#@react-native-community#cli#@react-native-community#cli-plugin-metro#metro-core#jest-haste-map#jest-worker#@types#node"
   - Hoisted from "react-native#@react-native-community#cli#@react-native-community#cli-plugin-metro#metro#jest-haste-map#jest-worker#@types#node"
info Disk size without dependencies: "1.75MB"
info Disk size with unique dependencies: "1.75MB"
info Disk size with transitive dependencies: "1.75MB"
info Number of shared dependencies: 0

Combined bases as a workaround for tsconfig.json `extends` limitations

Following the addition of the "strictest" config there is now an issue for users who want to use "strictest" and another base from this repo (ex. "node16").

Could an additional script be added to generate combined bases?

ex. given the input of

[
	["strictest", "node16", "esm"],
	["strictest", "node16"]
]

output the bases

  • strictest-node16-esm/tsconfig.json
  • strictest-node16/tsconfig.json

Where "strictest-node16-esm` is defined as "esm" (a potential new base, see #76) extends "node16" extends "strictest".

#55 should be documented

Hello! Thanks for this great package.

I have an project that uses @tsconfig/[email protected]. After upgrading it to @tsconfig/[email protected], it fails to compile.

ERROR in D:\Devel\Projects\devlog\devlog-web\app\index.ts
./app/index.ts 3:16-30
[tsl] ERROR in D:\Devel\Projects\devlog\devlog-web\app\index.ts(3,17)
      TS2307: Cannot find module './App.svelte' or its corresponding type declarations.
ts-loader-default_e3b0c44298fc1c14

Here's the diff between the @1.0.11 and the @2.0.1. As you can see, the types property is gone.

--- a/1.0.11.json
+++ b/2.0.1.json
@@ -16,8 +17,6 @@
       enable source maps by default.
      */
     "sourceMap": true,
-    /** Requests the runtime types from the svelte modules by default. Needed for TS files or else you get errors. */
-    "types": ["svelte"],

     "strict": false,
     "esModuleInterop": true,

Is it intended or bug? Should I stick to @1.0.10?

I'm wonder it might help but below are the packages I'm using.

Thank you.

EDIT

After some searching, I found that it's intended and a workaround is already mentioned #55 . And I think it should be documented somewhere. I'm sorry for bothering.

Provide a Changelog

While it is relatively easy to find the changes in the git history, it would be great to have a convenient changelog.
Also, having a short rationale for each change would be really awesome!

Add a react base?

Since this repo has a base for react-native, it might make sense to have one for react web?

Using npx create-react-app my-app --template typescript you end up with the following config, could be a good start for a base:

{
  "compilerOptions": {
    "target": "es5",
    "lib": [
      "dom",
      "dom.iterable",
      "esnext"
    ],
    "allowJs": true,
    "skipLibCheck": true,
    "esModuleInterop": true,
    "allowSyntheticDefaultImports": true,
    "strict": true,
    "forceConsistentCasingInFileNames": true,
    "noFallthroughCasesInSwitch": true,
    "module": "esnext",
    "moduleResolution": "node",
    "resolveJsonModule": true,
    "isolatedModules": true,
    "noEmit": true,
    "jsx": "react"
  },
  "include": [
    "src"
  ]
}

Make ES2020 default module system?

Background:
I created a new Node project and wanted to use @tsconfig/node14 base in my tsconfig. As EcmaScript modules are fully supported in Node 14 I began using the ESM syntax and got a runtime error because the base specifies CommonJS as module system.

I got the same error as this Stack Overflow post.

node server/
file:///C:/Users/stianahj/Documents/wishlist/server/dist/app.js:5
Object.defineProperty(exports, "__esModule", { value: true });
                      ^

ReferenceError: exports is not defined in ES module scope
This file is being treated as an ES module because it has a '.js' file extension and 'C:\Users\stianahj\Documents\wishlist\server\package.json' contains "type": "module". To treat it as a CommonJS script, rename it to use the '.cjs' file extension.
    at file:///C:/Users/stianj/Documents/wishlist/server/dist/app.js:5:23
?[90m    at ModuleJob.run (internal/modules/esm/module_job.js:169:25)?[39m
?[90m    at async Loader.import (internal/modules/esm/loader.js:177:24)?[39m
?[90m    at async Object.loadESM (internal/process/esm_loader.js:68:5)?[39m

Discussion point: Since ESM is a stable feature in Node 14, should ESM also be the module system in the @tsconfig/node14? I think it makes sense. Also wrote something in a comment on the docs microsoft/TypeScript-Website#1366 (comment).

Lastly, I can add that overriding the base works by simply specifying the field you want to override in your own tsconfig.json. One can still use the base, so this is just a discussion about what should be the default.

When running with extends for Node 14 I get not found

When extending my TypeScript configuration using node 14 I'm getting an error when using VS Code debugger.

File '@tsconfig/node14/tsconfig.json' not found.

tsconfig.json file contents:

{
  "extends": "@tsconfig/node14/tsconfig.json",
  "compilerOptions": {
    "esModuleInterop": true,
    "noEmitOnError": true,
    "outDir": "dist",
    "removeComments": false,
    "resolveJsonModule": true,
    "rootDir": ".",
    "sourceMap": true,
  },
  "include": [
    "**/*.ts",
    "**/*.spec.ts"
  ],
  "exclude": [
    "node_modules",
    "dist/*"
  ]
}

package.json file content excerpt:

  "devDependencies": {
    "@graphql-codegen/cli": "^2.2.0",
    "@graphql-codegen/introspection": "^2.1.0",
    "@graphql-codegen/typescript": "^2.2.2",
    "@graphql-codegen/typescript-resolvers": "^2.2.1",
    "@tsconfig/node14": "^1.0.1",
    "azure-functions-core-tools": "^3.0.3734",
    "typescript": "^4.4.3"
  }

Package listing:

โ”œโ”€โ”€ @tsconfig/[email protected] 
โ””โ”€โ”ฌ [email protected]
  โ””โ”€โ”€ @tsconfig/[email protected]  deduped

TypeScript tsconfig resolution can be shorter

{
  "extends": "@tsconfig/node10",
}

resolves to "@tsconfig/node10/tsconfig.json" by default in the compiler, but cmd + clicking doesn't work in the editor. Need to add support to TS before we can drop the final /tsconfig.json in the references.

DOM library in not excluded for node12 base

For a nodejs project, I want to exclude DOM library type definitions. I use the following compiler option

{
  "compilerOptions": {
    "lib": ["es2019", "es2020.promise", "es2020.bigint", "es2020.string"],
    "target": "es2019",
    "module": "commonjs",
    "skipLibCheck": true,
    "moduleResolution": "node",
    "allowSyntheticDefaultImports": true,
    "allowJs": true,
    "emitDecoratorMetadata": true,
    "experimentalDecorators": true,
    "inlineSourceMap": true,
    "importHelpers": true,
    "alwaysStrict": true,
    "strict": true,
    "outDir": "build",
    "forceConsistentCasingInFileNames": true,
    "esModuleInterop": true,
    "typeRoots": ["./node_modules/@types", "./typings"],
    "baseUrl": ".",
    "paths": {
      "#root/*": ["./*"]
    }
  },
  "include": [
    "src/**/*",
    "__tests__/**/*",
    "config/**/*",
    "scripts/bundle-test.ts"
  ],
  "exclude": ["node_modules"]
}

I have not included "dom" in the lib options but I am still getting the types from [VS Code installation folder]/code/resources/app/extensions/node_modules/typescript/lib/lib.dom.d.ts] being included in my workspace. This have lead to multiple run time errors. In particular, the parent object from Window is being included (declare var parent: Window;. Is there a way to avoid it?

Support for bumping to specific package versions

I'm currently exploring how to get rid of the "types": ["svelte"] entry in Svelte's tsconfig base. Doing this would be a breaking change, @tsconfig/svelte would need to be bumped to 2.0.0 if that (not-yet-created) PR would get merged. Is this possible with the current infrastructure? If so, how to accomplish it? If not, how would adding this look like?

Consider skipLibCheck to false

Hi there

I Love the idea of sharing tsconfig file. Great idea.
I can see in the recommended tsconfig.json that skipLibCheck is set to true.

Do we really want to enforce that behaviour ?
As I can see here:

There is pros in day to day coding but cons in the long term

@tsconfig/next is not published

Hey!

First of all, thank you for this amazing project!


โžœ npm install --save-dev @tsconfig/next

npm ERR! code E404
npm ERR! 404 Not Found - GET https://registry.npmjs.org/@tsconfig%2fnext - Not found
npm ERR! 404 
npm ERR! 404  '@tsconfig/next@*' is not in the npm registry.
npm ERR! 404 You should bug the author to publish it (or use the name yourself!)
npm ERR! 404 
npm ERR! 404 Note that you can also install from a
npm ERR! 404 tarball, folder, http url, or git url.

npm ERR! A complete log of this run can be found in:
npm ERR!     /Users/hnordt/.npm/_logs/2021-06-06T17_07_42_807Z-debug.log

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.