[vue-tsc] How to use with lint-stage

See original GitHub issue

I want to use vue-tsc for type checking in vue. I want to use lint-stage now, but vue-tsc can’t seem to find my tsconfig.json

  "lint-staged": {
    "*.{ts,tsx}": [
      "prettier --write",
      "eslint --fix",
      "tsc --noEmit --pretty false --skipLibCheck",
      "git add"
    ],
    "*.{json,js,jsx}": [
      "prettier --write",
      "eslint --fix",
      "git add"
    ],
    "*.vue": [
      "prettier --write",
      "eslint --fix",
      "vue-tsc --noEmit --skipLibCheck",
      "git add"
    ]
  },

I want to verify only the vue file in the temporary storage area. Do you know how to do it?

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:15 (1 by maintainers)

github_iconTop GitHub Comments

5reactions
Yill625commented, Jan 17, 2022

it’s ok! vue-tsc version 0.29.3

//.lintstagedrc.js
const fs = require('fs')

module.exports = {
  'src/**/*.{js,jsx,vue,ts,tsx}': ['yarn lint'],
  '*.{vue,ts}': [
    () => {
      return `vue-tsc --noEmit --skipLibCheck`
    },
  ],
}

2reactions
1018715564commented, Nov 11, 2021

But what I use now is pre_commit 😭 Does vue-tsc plan to do type checking on a batch of vue files in the future?

Read more comments on GitHub >

github_iconTop Results From Across the Web

How to setup lint-staged for Vue projects? - Stack Overflow
I created a new Vue3 app using the Vue CLI and selected Prettier for my linter config. I want to use commitlint, husky...
Read more >
lint-staged - npm
Start using lint-staged in your project by running `npm i lint-staged`. There are 1866 other projects in the npm registry using lint-staged.
Read more >
在vue3+ts项目中配置eslint、stylelint和commitlint - 掘金
在团队开发中,通常需要统一项目的代码规范和书写风格。这时候eslint、stylelint和commitlint就派上用场了。
Read more >
Run a TypeScript type check in your pre-commit hook using ...
Run a TypeScript type check in your pre-commit hook using lint-staged + husky ... Tip: use the --pretty flag in the tsc command...
Read more >
Fix Your Mistakes, Don't Commit Them! Pre-Commit Git Hook ...
It's time to stop committing broken tests, ugly code, type errors and lint errors to your git repository. With Husky, we can hook...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found