OfficeDev / Office-Addin-Scripts

A set of scripts and packages that are consumed in Office add-ins projects.
MIT License
159 stars 100 forks source link

ESLint files Pattern #288

Closed abimaelmartell closed 2 years ago

abimaelmartell commented 4 years ago

When i run npm run lint, i get the following message

> office-addin-lint check

Oops! Something went wrong! :(

ESLint: 6.8.0.

No files matching the pattern "src/**/*.js" were found.
Please check for typing mistakes in the pattern.

I'm writing a taskpane for Excel with Typescript and React. I haven't changed anything on the eslint configuration.

I'm have this on my package.json

 "office-addin-lint": "^1.0.21",

Thanks.

akrantz commented 4 years ago

Do you have your sources files in an src folder? Do they have a .js extension?

abimaelmartell commented 4 years ago

Yeah, i used the generator, so the structure is the default one for the React Typescript project.

Also, the docs mention that the default pattern is src/**/*.{ts,tsx,js,jsx}

Here is an example i created that also fails with the same error on the linter.

https://github.com/abimaelmartell/excel-stock-price-pane

As you can see i have tsx files on the src.

Keating950 commented 4 years ago

Usually setting "no-error-on-unmatched-pattern": 0 in .eslintrc.json fixes this, but oddly this issue is persisting for me even after adding it to my project root's config file and the config file found in office-addin-lint/config. (I'm doing the same thing as @abimaelmartell, trying to write a taskpane for Excel with Typescript+React.)

Passing --files src/**/*.{ts,tsx} as an argument still causes ESLint to fail with with the message No files matching the pattern "src/**/*.js" were found.

Running office-addin-lint --files=src/**/*.{ts,tsx} check works.

LouMM commented 4 years ago

@abimaelmartell Thank you again for reporting this issue. We are not able to reproduce the issue in house. Are you able to create new add-ins using the template, and they all exhibit the same issue?

LouMM commented 4 years ago

No additional information provided.

rahulahoop commented 2 years ago

FFR: The true answer is here

office-addin-lint prettier --files="src/**/*.{tsx,ts}"

hth

akrantz commented 2 years ago

Is the issue here that TypeScript is used and there are no *.js files? @millerds

rahulahoop commented 2 years ago

@akrantz the issue is that the documentation is unclear how to specify which files to scan for the linter option.

millerds commented 2 years ago

@akrantz, the lint command works just fine when there aren't any .js files present (like in the react template repo) so I don't believe it's a case of which files are present

@rahulahoop the lint package did not include a way to customize the linting that is done as it used its own built-in configuration (the local .eslintrc.json files was for the live linting in VS Code or other editors). However, I just finished publishing an update to the lint package that now looks for the local .eslintrc.json file and uses that over the built in one.

I would also note that there have been a number of updates to the linting tools since this issue was originally opened 1.5 years ago. I would like to see the current versions of the packages used to see if the issue continues (without any local .eslintrc.json overrides).

millerds commented 2 years ago

@abimaelmartell @Keating950 @rahulahoop . . . if you are still seeing issues with this using current versions of the templates and script packages please reopen.