ioBroker / create-adapter

Command line utility to create customized ioBroker adapters
MIT License
50 stars 23 forks source link

Missing directory for eslint - no checks are executed #907

Closed klein0r closed 2 years ago

klein0r commented 2 years ago

I've generated a new adapter. After that, the following npm script was added to my package.json:

"lint": "eslint --ext .js,.jsx",

https://github.com/ioBroker/create-adapter/blob/f82bffb5f86889e7c7f51298f137654007945c34/templates/package.json.ts#L189

The workflow also executes ioBroker/testing-action-check with lint flag.

https://github.com/ioBroker/create-adapter/blob/f82bffb5f86889e7c7f51298f137654007945c34/templates/_github/workflows/test-and-release.yml.ts#L47-L59

The default lint command is

npm run lint

without additional parameters. See

https://github.com/ioBroker/testing-action-check/blob/eee7d831dda68face4148bd37fd1514ad2c82eaf/action.yml#L21-L23


When running npm run lint, no files will be checked

$ npm run lint

> iobroker.luftdaten@2.2.4 lint
> eslint --ext .js,.jsx

Solution:

(tested with eslint 8.6.0)

AlCalzone commented 2 years ago

Sorry, I don't understand the problem. Did eslint not catch something it did after the change?

klein0r commented 2 years ago

The issue is, that the workflow executes the default lint command npm run lint - which has no target / checks no files (missing directory or glob pattern) in the current configuration.

When running npm run lint . (current dir), the ouput looks like this:

npm run lint .

> iobroker.luftdaten@2.2.4 lint
> eslint --ext .js,.jsx "."

/home/mkleine/ioBroker.luftdaten/main.js
  105:28  error  Promise executor functions should not be async  no-async-promise-executor
AlCalzone commented 2 years ago

got it, thanks!