Nx: What does ./node_modules/.bin/nx lint do?

Created on 10 Oct 2018  路  8Comments  路  Source: nrwl/nx

It seems ./node_modules/.bin/nx lint is not doing anything. What is it supposed to do?

question / discussion

All 8 comments

i experienced same thing. it is doing nothing for me with latest nx.
i use npm run affected:lint -- --uncommitted --fix --parallel to automatically lint when users commit code.

Hi @dereklin,

The command ./node_modules/.bin/nx lint verifies that your Nx Workspace is not inconsistent nor has some files out of sync. This command will show you the problem if you start deviating from the Nx guidelines when creating a library or an application not in the right place.

The command lint from Nx does Workspace integrity checks of your /apps and /libs like so:

  • check the consistency of your dependencies;
  • check if you have declared project in your angular.json that target nowhere;
  • chick if you have apps or libs that are not declared in your angular.json;

This is more like a Nx validation of your project's configuration than simply checking _language errors_. The latter is done with the ng lint command which is the code linting from the Angular CLI.

Hi @bcabanes,

When you say

The latest is done with the ng lint command which is the code linting from the Angular CLI.

Does it mean ./node_modules/.bin/nx lint is no longer needed if we use ng lint?

No sorry i'meant to say _the latter_, they do different things.

You want to have nx lint for checking the integrity of your workspace against Nx guidelines, and ng lint for checking code errors.

I would not remove the nx lint command.

@dereklin: Your workspace lint command should actually run ./node_modules/.bin/nx lint && ng lint.

Thanks @bcabanes and @skorunka

@bcabanes : has this changed in recent releases?

I see this in my build output:

> nx lint && ng lint
>  NX   NOTE  Nx didn't recognize the command, forwarding on to the Angular CLI.

@tmtron This is caused by our new shiny CLI, this Note will be fixed in the next release ;)

Was this page helpful?
0 / 5 - 0 ratings

Related issues

about-code picture about-code  路  3Comments

Svancara picture Svancara  路  3Comments

jon301 picture jon301  路  3Comments

Koslun picture Koslun  路  3Comments

IonFoXx picture IonFoXx  路  3Comments