Giter Site home page Giter Site logo

typed-ember / ember-cli-tslint Goto Github PK

View Code? Open in Web Editor NEW
11.0 2.0 4.0 757 KB

Ember CLI addon for linting Ember projects with TSLint

License: MIT License

JavaScript 91.49% TypeScript 1.42% HTML 6.55% Handlebars 0.54%
ember-cli tslint glimmerjs emberjs

ember-cli-tslint's Introduction

๐Ÿ›‘ ARCHIVED, please use ESLint instead ๐Ÿ›‘


ember-cli-tslint

Build Status Build Status

TSLint for Ember CLI apps and addons

Installation

ember install ember-cli-tslint

ember-cli-tslint will remove ESLint from your current project and replace the config files with a new tslint.json file.

Usage

TSLint will be run by ember-cli-qunit automatically when you run ember test. ember-cli-mocha is not yet supported.

Contributing

Installation

  • git clone <repository-url> this repository
  • cd ember-cli-tslint
  • yarn install

Running

Running Tests

  • yarn test (Runs ember try:each to test your addon against multiple Ember versions)
  • ember test
  • ember test --server

Building

  • ember build

For more information on using ember-cli, visit https://ember-cli.com/.

License

This project is licensed under the MIT License.

ember-cli-tslint's People

Contributors

azure-pipelines[bot] avatar buschtoens avatar chriskrycho avatar ember-tomster avatar greenkeeper[bot] avatar mike-north avatar renovate-bot avatar t-sauer avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

ember-cli-tslint's Issues

Ability to configure broccoli-tslinter

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().

Don't remove ESLint?

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!

State broken "rule" with linting failures

Currently, rule violations do not state the name of the rule in question being violated.

screen shot 2017-12-16 at 11 25 26 am

User Story:

As a developer, I need to be able to know the name of the rule being violated in order to decide whether I want to disable the rule or alter my code to align with it.

Action Required: Fix Renovate Configuration

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 (@)

Warning: The 'XXX' rule requires type information.

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?

Safe-by-default: underscore-prefixed unused args

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.

https://github.com/palantir/tslint/blob/9d7db479596c50bbf89fa87d498ab927763a6eec/src/configs/recommended.ts#L187-L192

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"]
    }

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.