1
0
Fork 0
salty-dog/rules/tsconfig.yml

83 lines
1.9 KiB
YAML
Raw Normal View History

2019-06-30 22:41:45 +00:00
name: salty-dog-tsconfig
rules:
- name: allow-errors
desc: do not suppress errors
level: info
tags:
- tsconfig
- errors
select: '$.compilerOptions'
check:
not:
anyOf:
- required: [suppressExcessPropertyErrors]
- required: [suppressImplicitAnyIndexErrors]
- name: redundant-strict
2019-06-30 22:41:45 +00:00
desc: omit redundant strict mode options
level: info
tags:
- tsconfig
- strict
select: '$.compilerOptions'
filter:
type: object
required: [strict]
properties:
strict:
type: boolean
const: true
check:
not:
anyOf:
# from https://www.typescriptlang.org/docs/handbook/compiler-options.html
- required: [alwaysStrict]
2019-06-30 22:41:45 +00:00
- required: [noImplicitAny]
- required: [noImplicitThis]
- required: [strictBindCallApply]
- required: [strictNullChecks]
- required: [strictFunctionTypes]
- required: [strictPropertyInitialization]
- name: target-lib
desc: ensure the target and lib match
level: info
tags:
- tsconfig
- target
select: '$.compilerOptions'
filter:
type: object
required: [lib, target]
properties:
lib:
type: array
target:
type: string
pattern: "^es([0-9]+|next)$"
2019-06-30 22:41:45 +00:00
check:
allOf:
- type: object
required: [lib, target]
properties:
lib:
type: array
items:
type: string
target:
type: string
- oneOf:
- properties:
lib:
contains:
type: string
const:
$data: "2/target"
2019-06-30 22:41:45 +00:00
target:
type: string
enum: [esnext, es2017, es2016, es5, es3]