typed-ember / ember-cli-tslint Goto Github PK
View Code? Open in Web Editor NEWEmber CLI addon for linting Ember projects with TSLint
License: MIT License
Ember CLI addon for linting Ember projects with TSLint
License: MIT License
In order to avoid repeated Using tslint.json as the default file for linting rules
messages, we need to pass a configuration
option to broccoli-tslinter
.
Being able to set other options would likely to useful too.
Currently an empty options hash is being passed to TSLint()
.
Currently if you create a new ember app, add ember-cli-typescript
and ember-cli-tslint
, followed by something like
ember g route home
and then define a route as shown below, you'll get two warnings from the TypeScript compiler due to ember-cli-typescript
using the --noUnusedParameters
flag
import Route from "@ember/routing/route";
import { Ember } from "ember";
import Model from "ember-data/model";
export default class Home extends Route.extend({
// anything which *must* be merged to prototype here
}) {
// normal class body definition here
public async afterModel(
resolvedModel: Model, // WARNING: 'resolvedModel' is declared but its value is never read.
transition: Ember.Transition // WARNING: 'transition' is declared but its value is never read.
) {}
}
The TS team has adopted leading underscores as way of treating unused variables without losing developer intent (i.e., naming a parameter _
doesn't leave info for fellow developers who may want to use it in the future -- _model
gives them a clue).
Unfortunately, in an ember app, this leads to a tslint error. Apparently Palantir feels that unused parameters of any kind should be treated as errors.
import Route from "@ember/routing/route";
import { Ember } from "ember";
import Model from "ember-data/model";
export default class Home extends Route.extend({
// anything which *must* be merged to prototype here
}) {
// normal class body definition here
public async afterModel(
_resolvedModel: Model, // ERROR: [tslint] variable name must be in lowerCamelCase, PascalCase or UPPER_CASE (variable-name)
_transition: Ember.Transition // ERROR: [tslint] variable name must be in lowerCamelCase, PascalCase or UPPER_CASE (variable-name)
) {}
}
This leaves developers with guaranteed errors or warnings by default, the first time they run into a situation where they must disregard a function parameter.
Let's adopt Microsoft's convention and allow these leading underscores by default across all ember apps. We'd need to allow this by default for JS and TS.
"variable-name": {
"options": ["allow-leading-underscore"]
}
Our project, like many TypeScript projects, is in a slow process of transition. We want to be linting both our unconverted JavaScript and our converted and new TypeScript.
In our specific case, we also have separate eslint and tslint configs, so we want both to run!
Hi, thanks for the great plugin!
When I'm using SonarTS I get a bunch of:
Warning: The 'no-array-delete' rule requires type information.
Warning: The 'no-collection-size-mischeck' rule requires type information.
...
In the README it says to pass something like --project ./tsconfig.json
to tslint
. Is this possible when using ember-cli-tslint
?
There is an error with this repository's Renovate configuration that needs to be fixed. As a precaution, Renovate will stop PRs until it is resolved.
Error type: Cannot find preset's package (@)
Hey just let you know I've submitted another issue here: kratiahuja/broccoli-tslinter#25
But do you have any plan to switch the dependency of broccoli-tslinter? Or is possible to contact that author. It's not being updated for 5 months.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.