• Stars
    star
    455
  • Rank 96,175 (Top 2 %)
  • Language
    JavaScript
  • License
    MIT License
  • Created about 5 years ago
  • Updated about 1 year ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Typescript style guide, linter, and formatter using StandardJS

Tests npm npm License TS-Standard - TypeScript Standard Style Guide Dependabot badge

ts-standard

TypeScript Style Guide, with linter and automatic code fixer based on StandardJS

๐Ÿ’พ Install

npm install --save-dev ts-standard

โŒจ๏ธ Basic Usage

ts-standard

Enable auto code fixing

ts-standard --fix

Note: A tsconfig.json or similar project file is required. See TSConfig section below for more details

๐Ÿ“œ Help

ts-standard - Standard for TypeScript! (https://github.com/standard/ts-standard)

Usage:
  ts-standard <flags> [FILES...]

  If FILES is omitted, all JavaScript/TypeScript source files (*.js, *.jsx, *.mjs, *.cjs, *.ts, *.tsx)
  in the current working directory are checked, recursively.

  Certain paths (node_modules/, coverage/, vendor/, *.min.js, and
  files/folders that begin with '.' like .git/) are automatically ignored.

  Paths in a project's root .gitignore file are also automatically ignored.

Flags:
      --fix       Automatically fix problems
  -p, --project   Specify ts-config location (default: ./tsconfig.eslint.json or ./tsconfig.json)
      --version   Show current version
  -h, --help      Show usage information

Flags (advanced):
      --stdin     Read file text from stdin
      --ext       Specify JavaScript/TypeScript file extensions
      --global    Declare global variable
      --plugin    Use custom eslint plugin
      --env       Use custom eslint environment
      --parser    Use custom ts/js parser (default: @typescript-eslint/parser)

๐Ÿงฌ TSConfig: Linting with Type Information

By default ts-standard will search the current working director (cwd) for the following in order

  1. tsconfig.eslint.json
  2. tsconfig.json

You can also manually configure the location of the tsconfig file by either passing the path to the --project flag or adding a ts-standard configuration property to your package.json file.

{
  "ts-standard": {
    "project": "path/to/tsconfig.json"
  }
}

๐Ÿ—‘ Ignoring files and folders

You can add an ignore property to your package.json ts-standard configuration settings.

{
  "ts-standard": {
    "ignore": [
      "dist",
      "src/**/*.js"
    ]
  }
}

๐Ÿšซ Please change X rule

This project has no control over the rules implemented, as such this project cannot change any of the rules that have been configured. If you want to discuss the rules, please visit the rules configuration repo eslint-config-standard-with-typescript.

๐Ÿง™ Why

This utility was designed to be the standard equivalent for typescript. Underneath the hood, this utility uses the same standard-engine and combines that engine with the official eslint-config-standard-with-typescript ruleset.

You can also choose to just use eslint with the eslint-config-standard-with-typescript shareable config instead and achieve the same results as this project. But ts-standard saves you from having to manually install all the extra dependencies and may reduce configuration overhead.

๐ŸŽ‰ Special Thanks

Special thanks to standard for inspiration and some shared code and to eslint-config-standard-with-typescript for creating a typescript specific standard.

๐Ÿ“‹ Contributing Guide

I welcome all pull requests. Please make sure you add appropriate test cases for any features added. Before opening a PR please make sure to run the following scripts:

  • npm run lint:standard checks for code errors and format according to standard
  • npm test make sure all tests pass

More Repositories

1

standard

๐ŸŒŸ JavaScript Style Guide, with linter & automatic code fixer
JavaScript
29,036
star
2

eslint-config-standard

ESLint Config for JavaScript Standard Style
TypeScript
2,597
star
3

semistandard

๐Ÿฆ All the goodness of `standard/standard` with semicolons sprinkled on top.
JavaScript
1,407
star
4

eslint-config-standard-react

ESLint Shareable Config for React/JSX support in JavaScript Standard Style
JavaScript
457
star
5

snazzy

Format JavaScript Standard Style as Stylish (i.e. snazzy) output
JavaScript
421
star
6

awesome-standard

Documenting the explosion of packages in the standard ecosystem!
392
star
7

standard-engine

๐Ÿš’ The guts of `standard` modularized for reuse
JavaScript
146
star
8

standardx

๐Ÿ’ฅ JavaScript Standard Style with custom tweaks
JavaScript
145
star
9

eslint-plugin-standard

ESlint Rules for the Standard Linter
JavaScript
125
star
10

vscode-standard

VS Code extension for JavaScript Standard Style (`standard`) with automatic fixing
TypeScript
122
star
11

eslint-config-standard-jsx

ESLint Shareable Config for JSX support in JavaScript Standard Style
JavaScript
103
star
12

standard-loader

webpack loader for linting your code with https://github.com/feross/standard
JavaScript
68
star
13

eslint-config-semistandard

๐Ÿ’ฏ semistandard eslint sharable config
JavaScript
63
star
14

atom-standardjs-snippets

โšก A collection of JavaScript snippets for Atom, Standard Style
CoffeeScript
48
star
15

deglob

๐Ÿ“‚ Take a list of glob patterns and return an array of file locations, respecting `.gitignore` and allowing for ignore patterns via `package.json`.
JavaScript
40
star
16

atom-standard-formatter

Atom package to format code using Javascript Standard Style.
JavaScript
35
star
17

standard-packages

List of packages that use `standard`
JavaScript
33
star
18

standard-www

๐Ÿ‘† Website for JavaScript Standard Style (@standard)
CSS
30
star
19

standard-json

๐Ÿ”›Format JavaScript Standard Style output to a JSON array.
JavaScript
21
star
20

standard-tap

๐Ÿšฐ Format JavaScript Standard Style as TAP output
JavaScript
17
star
21

brackets-standard

Brackets extension for standard, a simple linter with sensible defaults. No longer maintained, Try using https://github.com/zaggino/brackets-eslint and https://github.com/feross/eslint-config-standard
JavaScript
10
star
22

.github

9
star
23

standard-demo

๐Ÿฐ Web demo of JavaScript Standard Style (Work In Progress)
JavaScript
9
star
24

standardizer

๐Ÿ’ซ A tiny service to lint and format JavaScript code using JavaScript Standard Style.
JavaScript
8
star