All Projects → Glavin001 → Tslint Clean Code

Glavin001 / Tslint Clean Code

Licence: other
TSLint rules for enforcing Clean Code

Programming Languages

typescript
32286 projects

Projects that are alternatives of or similar to Tslint Clean Code

Clean Flutter
This repo is a small explanation of clean architecture on with flutter framework and some test where added
Stars: ✭ 108 (-33.33%)
Mutual labels:  clean-code
Clean Go Article
A reference for the Go community that covers the fundamentals of writing clean code and discusses concrete refactoring examples specific to Go.
Stars: ✭ 1,911 (+1079.63%)
Mutual labels:  clean-code
Cleanarchitecture.workerservice
A solution template using Clean Architecture for building a .NET Core Worker Service.
Stars: ✭ 142 (-12.35%)
Mutual labels:  clean-code
Todo
✅ Commad-Line Task management with storage on your GitHub 🔥
Stars: ✭ 111 (-31.48%)
Mutual labels:  clean-code
Code Pal For Abap
code pal for ABAP is a highly configurable engine, fully integrated into the ABAP development framework ensuring Cloud’s built-in quality.
Stars: ✭ 121 (-25.31%)
Mutual labels:  clean-code
Go Clean Architecture
👨‍💻 REST API example, built by following Uncle Bob’s clean architecture principles
Stars: ✭ 133 (-17.9%)
Mutual labels:  clean-code
Android Kotlin Clean Architecture
Android Sample Clean Architecture App written in Kotlin
Stars: ✭ 1,562 (+864.2%)
Mutual labels:  clean-code
Phpmd
PHPMD is a spin-off project of PHP Depend and aims to be a PHP equivalent of the well known Java tool PMD. PHPMD can be seen as an user friendly frontend application for the raw metrics stream measured by PHP Depend.
Stars: ✭ 1,992 (+1129.63%)
Mutual labels:  clean-code
Go Bank Transfer
Simple API for banking routines using a Clean Architecture in Golang. 💳 💰 💸
Stars: ✭ 123 (-24.07%)
Mutual labels:  clean-code
Android Modular Architecture
📚 Sample Android Components Architecture on a modular word focused on the scalability, testability and maintainability written in Kotlin, following best practices using Jetpack.
Stars: ✭ 2,048 (+1164.2%)
Mutual labels:  clean-code
Xaml Code Experiences
A collection of the experiences I have collected during days of Xamarin and Wpf, while following the MVVM design pattern.
Stars: ✭ 114 (-29.63%)
Mutual labels:  clean-code
Live News Viper
A simple project to demonstrate VIPER design pattern.
Stars: ✭ 119 (-26.54%)
Mutual labels:  clean-code
Php Programming Best Practices
Referencia para los desarrolladores de Tiendanube y para la comunidad de PHP.
Stars: ✭ 138 (-14.81%)
Mutual labels:  clean-code
React Native Keyboard Spacer
Plug and play react-native keyboard spacer view.
Stars: ✭ 1,475 (+810.49%)
Mutual labels:  clean-code
Clean Code Javascript
Conceitos de Código Limpo adaptados em JavaScript (Tradução PT-BR)
Stars: ✭ 2,241 (+1283.33%)
Mutual labels:  clean-code
Clean Code Javascript
🛁 Clean Code concepts adapted for JavaScript
Stars: ✭ 62,912 (+38734.57%)
Mutual labels:  clean-code
Genericdatasource
A generic small reusable components for data source implementation for UITableView/UICollectionView in Swift.
Stars: ✭ 127 (-21.6%)
Mutual labels:  clean-code
Android Clean Architecture
Showcasing a Clean Architecture approach from our Android applications framework!
Stars: ✭ 160 (-1.23%)
Mutual labels:  clean-code
Clean Code Java
Clean Code concepts adapted for Java. Based on @ryanmcdermott repository.
Stars: ✭ 155 (-4.32%)
Mutual labels:  clean-code
Android Clean Architecture Mvvm Dagger Rx
Implemented by Clean Architecture, Dagger2, MVVM, LiveData, RX, Retrofit2, Room, Anko
Stars: ✭ 138 (-14.81%)
Mutual labels:  clean-code

tslint-clean-code Build Status Build status

A set of TSLint rules used to enforce Clean Code practices. Inspired by Clean Code: A Handbook of Agile Software Craftsmanship.

👉 Sign up for CodePass, the Quickest Way To Solve Your Coding Errors! 💥

Installation

npm install tslint-clean-code

Configuration

Configure tslint.json

In your tslint.json file, extend this package. For example:

{
  "extends": [
    "tslint-clean-code"
  ],
  "rules": {
    "newspaper-order": true
  }
}

You can also extend other tslint config packages to combine this plugin with other community custom rules.

Configure your Grunt build task

Add the new rulesDirectory to your tslint task:

grunt.initConfig({
  tslint: {
    options: {
      rulesDirectory: 'node_modules/tslint-clean-code/dist/src',
      configuration: grunt.file.readJSON("tslint.json")
    },
    files: {
      src: ['src/file1.ts', 'src/file2.ts']
    }
  }
})

The tslint.json file does not change format when using this package. Just add our rule definitions to your existing tslint.json file.

Supported Rules

Rule Name Description Since
id-length Enforces a minimum and/or maximum identifier length convention. 0.1.0
try-catch-first Try-catch blocks must be first within the scope. Try-catch blocks are transactions and should leave your program in a consistent state, no matter what happens in the try. 0.1.0
max-func-args Limit the number of input arguments for a function. The ideal number of arguments for a function is zero (niladic). 0.1.0
min-class-cohesion The more variables a method manipulates the more cohesive that method is to its class. A class in which each variable is used by each method is maximally cohesive. We would like cohesion to be high. When cohesion is high, it means that the methods and variables of the class are co-dependent and hang together as a logical whole. 0.1.0
newspaper-order We would like a source file to be like a newspaper article. Detail should increase as we move downward, until at the end we find the lowest level functions and details in the source file. 0.1.0
no-flag-args Functions should only do one thing, therefore passing a boolean into a function is a bad practice. The function does one thing if the flag is true and another if the flag is false! 0.1.0
no-for-each-push Enforce using Array.prototype.map instead of Array.prototype.forEach and Array.prototype.push. 0.1.0
no-feature-envy A method accesses the data of another object more than its own data. 0.1.8
no-map-without-usage Ensure results of Array.prototype.map is either assigned to variable or returned 0.1.0
no-complex-conditionals Enforce the maximum complexity of conditional expressions. 0.1.0
prefer-dry-conditionals Don't-Repeat-Yourself in if statement conditionals, instead use Switch statements. 0.1.0
no-commented-out-code Code must not be commented out. 0.2.0

Development

To develop tslint-clean-code simply clone the repository, install dependencies and run grunt:

git clone [email protected]:Glavin001/tslint-clean-code.git --config core.autocrlf=input --config core.eol=lf
cd tslint-clean-code
npm install
grunt all
grunt create-rule --rule-name=no-something-or-other

Debug code

If command fails because of file access permissions, prefix it with sudo.

npm install -g node-inspector

Then run:

node-debug grunt mochaTest

The node-debug command will load Node Inspector in your default browser (works in Chrome and Opera only).

Set a breakpoint somewhere in your code and resume execution. Your breakpoint should be hit.

Thank you

Thank you to maintainers of tslint-microsoft-contrib, from which this repository was forked. The initial structure was kept and new rules were added, this would not have been possible without Microsoft's awesome work!

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].