preboot / angular-webpack

A complete, yet simple, starter for Angular v2+ using webpack
MIT License
1.29k stars 556 forks source link

update codelyzer and related #279

Closed GaryB432 closed 7 years ago

GaryB432 commented 7 years ago

Goals:

All rules recommended by codelyzer, except templates-use-public, are enabled.

The no-unused-variable rule is no longer supported by ts-lint. The check is handled by typescript@2.0 itself with the noUnusedLocals and noUnusedParameters compiler options. Staying away from modifying your src folder, I did not set these flags in tsconfig.json because "Property 'api' is declared but never used." in app component. This passed the old no-unused-variable rule as is, I guess because of it being a "parameter property" or being used in the template. (?)

no-unreachable is similiarly covered by the --allowUnreachableCode tsc compiler option.

label-undefined and no-duplicate-key are also no longer part of ts-lint and supported by tsc.

Other rule changes are due to combining, for example, the older component/directive naming rules.

I have gone further in my fork and would be happy to update this branch with the following. Let me know.

 constructor(public api: ApiService) {
  // Do something with api
  console.log(api.title);
}

I am also enabling some security-related rules from Microsoft which are interesting but I predict you'll not want those as you strive to maintain the starter's simplicity. Let me know othewise.

This is the best starter kit. Thanks for your hard work!

Foxandxss commented 7 years ago

I am good with bringing the templates use public and the tsconfig part.

For the service, perhaps it would be better to create a public variable and assign what we need from the API other than putting the entire api public.