standard / ts-standard

Typescript style guide, linter, and formatter using StandardJS
https://www.npmjs.com/package/ts-standard
MIT License
464 stars 36 forks source link

ts-standard is linting *.min.js files #270

Closed corgrath closed 1 year ago

corgrath commented 1 year ago

What version of this package are you using? ts-standard --version says 12.0.1

What operating system, Node.js, and npm version? MacOS Monterey npm 8.3.1 node 17.4.0

What happened? I am using ts-standard in my front end TypeScript project.

My folder structure looks like:

package.json
src/
    backend/
        tsconfig.json
        src/**/*.ts
    frontend/
        tsconfig.json
        src/**/*.ts
        libs/showdown.min.js

Where I have both a TypeScript backend and a front end project, and in the front end project I have the external thirdparty minified file libs/showdown.min.js.

When I run ts-standard, it is linting all the files in the src/frontend/** folder, but unfortunately also the showdown.min.js:

$ node_modules/.bin/ts-standard --ext ts --project src/frontend/tsconfig.json src/frontend

/Users/corgrath/go/src/myproject/src/frontend/libs/showdown.min.js:2:81754](http:/myproject/src/frontend/libs/showdown.min.js:2:81754): 'define' is not defined. (no-undef)

Even with --ext ts and --ext .ts the file is linted.

I have also tried this in the main package.json:

{
  "ts-standard": {
    "ignore": [
      "src/**/*.js"
    ]
  }
}

What did you expect to happen? All *.min.js files should be excluded from the linting.

Are you willing to submit a pull request to fix this bug?

theoludwig commented 1 year ago

Hey! @corgrath Thanks for your report!

I can't reproduce the issue, please provide a minimal reproductible example. By default *.min.js files are ignored. JavaScript files are included like *.js. But in package.json with:

"ts-standard": {
  "ignore": ["**/*.js"]
},

It successfully ignores all JavaScript files.