Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Linting issues on ionic-mocks #257

Closed
lathonez opened this issue Jul 13, 2017 · 13 comments
Closed

Linting issues on ionic-mocks #257

lathonez opened this issue Jul 13, 2017 · 13 comments

Comments

@lathonez
Copy link
Owner

Getting a ton of linting errors running

ion-app-scripts lint

From ionic-mocks. Not sure what the story is, they are in node_modules so shouldn't be linted.

https://stackoverflow.com/questions/42483922/exclude-node-modules-from-tslint-in-ionic-2-app

stonelasley/ionic-mocks#5

Obviously ng-cli doesn't give the errors.

@lathonez
Copy link
Owner Author

2d6223f

@hfwittmann
Copy link
Contributor

hfwittmann commented Jul 24, 2017

I just noticed that in the current setup when I run

npm run lint

it does not pick up linting errors for files in src's sub-directories. E.g deliberately introducing linting errors in say
./src/pages/clickerList/clickerList.ts
leads to no complaints.

However, the following command notes the errors:
./node_modules/tslint/bin/tslint ./src/**/*.ts

I am not sure what's causing this.

@lathonez
Copy link
Owner Author

Hey Felix,

I can't replicate that behaviour here:

C:\Users\lathonez\code\clicker [master ≡ +0 ~1 -0 !]
λ  git pull origin master
From github.com:lathonez/clicker
 * branch            master     -> FETCH_HEAD
Already up-to-date.
C:\Users\lathonez\code\clicker [master ≡ +0 ~1 -0 !]
λ  git diff
diff --git a/src/pages/clickerList/clickerList.ts b/src/pages/clickerList/clickerList.ts
index f1e7adf..c21a15b 100644
--- a/src/pages/clickerList/clickerList.ts
+++ b/src/pages/clickerList/clickerList.ts
@@ -15,6 +15,6 @@ export class ClickerList {
   constructor(nav: NavController, clickerService: ClickersService) {
     this.nav = nav;
     this.clickerService = clickerService;
-    this.title = 'Clickers';
+    this.title = 'Clickers'
   }
 }
C:\Users\lathonez\code\clicker [master ≡ +0 ~1 -0 !]
λ  npm run lint

> [email protected] lint C:\Users\lathonez\code\clicker
> tslint ./src/**/*.ts

Warning: The 'no-unused-variable' rule requires type checking
Warning: The 'no-use-before-declare' rule requires type checking

ERROR: src/pages/clickerList/clickerList.ts[18, 28]: Missing semicolon

npm ERR! Windows_NT 10.0.14393
npm ERR! argv "C:\\Program Files\\nodejs\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "run" "lint"
npm ERR! node v7.6.0
npm ERR! npm  v4.1.2
npm ERR! code ELIFECYCLE
npm ERR! [email protected] lint: `tslint ./src/**/*.ts`
npm ERR! Exit status 2
npm ERR!
npm ERR! Failed at the [email protected] lint script 'tslint ./src/**/*.ts'.
npm ERR! Make sure you have the latest version of node.js and npm installed.
npm ERR! If you do, this is most likely a problem with the Clicker package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR!     tslint ./src/**/*.ts
npm ERR! You can get information on how to open an issue for this project with:
npm ERR!     npm bugs Clicker
npm ERR! Or if that isn't available, you can get their info via:
npm ERR!     npm owner ls Clicker
npm ERR! There is likely additional logging output above.

npm ERR! Please include the following file with any support request:
npm ERR!     C:\Users\lathonez\code\clicker\npm-debug.log

Do you have a repro?

Stephen

@hfwittmann
Copy link
Contributor

hfwittmann commented Jul 25, 2017

Hey Stephen,

I have a repro, please find below. my system is ubuntu linux

Other system variables are
uname -a

Linux felix-tuxedo 4.4.0-87-generic #110-Ubuntu SMP Tue Jul 18 12:55:35 UTC 2017 x86_64 x86_64 x86_64 GNU/Linux

ionic -v
3.5.0

npm -v
4.2.0

node -v
v7.10.0

Here's the repro

# prepare

 npm -g remove ionic cordova
 npm -g install ionic cordova


 git clone https://github.com/lathonez/clicker
 cd clicker
 npm install
 npm install
 # 2nd necessary due to cordova errors
 
 
 # now manually change line in file clickerList.ts to introduce linting error
 
# end : prepare
	--- a/src/pages/clickerList/clickerList.ts
	+++ b/src/pages/clickerList/clickerList.ts
	@@ -15,6 +15,6 @@ export class ClickerList {
	   constructor(nav: NavController, clickerService: ClickersService) {
	     this.nav = nav;
	     this.clickerService = clickerService;
	-    this.title = 'Clickers';
	+    this.title = 'Clickers'
	   }
	 }
npm run lint

	> [email protected] lint /home/hfwittmann/Development/clicker
	> tslint ./src/**/*.ts

	Warning: The 'no-unused-variable' rule requires type checking
	Warning: The 'no-use-before-declare' rule requires type checking


./node_modules/tslint/bin/tslint ./src/**/*.ts

	Warning: The 'no-unused-variable' rule requires type checking
	Warning: The 'no-use-before-declare' rule requires type checking

	ERROR: src/pages/clickerList/clickerList.ts[18, 28]: Missing semicolon

So it's a mystery.

@lathonez
Copy link
Owner Author

Weird - maybe an ubuntu thing

@lathonez lathonez reopened this Jul 25, 2017
@lathonez
Copy link
Owner Author

I can replicate, ish, on ubuntu. It doesn't pick up the error, but using via node_modules doesn't either

@lathonez
Copy link
Owner Author

guess it's a directory depth thing. I thought ** did all dirs:

DEV:~/clicker$ ./node_modules/tslint/bin/tslint ./src/**/**/*.ts
Warning: The 'no-unused-variable' rule requires type checking
Warning: The 'no-use-before-declare' rule requires type checking

ERROR: src/pages/clickerList/clickerList.ts[18, 28]: Missing semicolon

@hfwittmann
Copy link
Contributor

This is bizarrre. I get

./node_modules/tslint/bin/tslint ./src/**/*.ts
Warning: The 'no-unused-variable' rule requires type checking
Warning: The 'no-use-before-declare' rule requires type checking

ERROR: src/pages/clickerList/clickerList.ts[18, 28]: Missing semicolon

but with the /// I get the result several times

./node_modules/tslint/bin/tslint ./src/**/**/*.ts
Warning: The 'no-unused-variable' rule requires type checking
Warning: The 'no-use-before-declare' rule requires type checking

ERROR: src/pages/clickerList/clickerList.ts[18, 28]: Missing semicolon
ERROR: src/pages/clickerList/clickerList.ts[18, 28]: Missing semicolon
ERROR: src/pages/clickerList/clickerList.ts[18, 28]: Missing semicolon

@lathonez
Copy link
Owner Author

lathonez commented Jul 25, 2017

@hfwittmann

can you add single quotes around the path in package.json and see if it resolves for you (it does for me on ubuntu):

@@ -7,7 +7,7 @@
         "ionic_enable_lint": false
     },
     "scripts": {
-        "lint": "tslint ./src/**/*.ts",
+        "lint": "tslint './src/**/*.ts'",
         "clean": "ionic-app-scripts clean",
         "build": "ionic-app-scripts build",
         "ionic:build": "ionic-app-scripts build",

@hfwittmann
Copy link
Contributor

Yes it does!

With the single quotes it works as expected

@lathonez
Copy link
Owner Author

excellent, thanks for raising this

@hfwittmann
Copy link
Contributor

thank you for solving it!

@lathonez
Copy link
Owner Author

2e0c3a4

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants