Skip to content

Commit

Permalink
Merge pull request #7 from MailOnline/fix/tweaks-1
Browse files Browse the repository at this point in the history
Relax rules, exclude folders
  • Loading branch information
claudiorodriguez authored Apr 16, 2018
2 parents a7cdbb8 + 8008cc5 commit e249c2d
Show file tree
Hide file tree
Showing 3 changed files with 46 additions and 23 deletions.
8 changes: 5 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,10 @@ MailOnline TSLint configuration.

## Usage

Add `tslint-config-mailonline`, `tslint`, and `typescript` as development dependencies:
Add `tslint-config-mailonline`, `tslint`, `typescript`, and `prettier` as development dependencies:

```bash
yarn add --dev tslint-config-mailonline tslint typescript
yarn add --dev tslint-config-mailonline tslint typescript prettier
```

Create TSLint configuration file (`tslint.json`) that extends `tslint-config-mailonline`:
Expand All @@ -31,7 +31,9 @@ Add the following script command to your `package.json`:

```json
{
"lint": "prettier './**/*.{js,jsx,ts,tsx}' --write && tslint './src/**/*.{js,jsx,ts,tsx}'"
"lint:prettier": "prettier --ignore-path .gitignore --write './**/*.{js,jsx,ts,tsx}'",
"lint:tslint": "tslint './**/*.{js,jsx,ts,tsx}' -t verbose",
"lint": "yarn run lint:prettier && yarn run lint:tslint"
}
```

Expand Down
49 changes: 33 additions & 16 deletions index.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
/* tslint:disable:prefer-object-spread */
const commonRules = {
'ban': [
true,
Expand All @@ -15,10 +16,10 @@ const commonRules = {
'no-dynamic-delete': true,
'no-empty': false,
'no-implicit-dependencies': [true, 'dev'],
'no-import-side-effect': [true, {"ignore-module": "\\.css$"}],
'no-import-side-effect': [true, {'ignore-module': '\\.css$'}],
'no-invalid-template-strings': true,
'no-invalid-this': true,
'no-magic-numbers': true,
'no-magic-numbers': false,
'no-parameter-reassignment': true,
'no-require-imports': true,
'no-return-await': true,
Expand All @@ -28,6 +29,14 @@ const commonRules = {
'no-unnecessary-callback-wrapper': true,
'no-unnecessary-class': true,
'object-literal-sort-keys': [true, 'ignore-case'],
'ordered-imports': [
true,
{
'grouped-imports': true,
'import-sources-order': 'any',
'named-imports-order': 'any'
}
],
'prefer-conditional-expression': [true, 'check-else-if'],
'prefer-function-over-method': true,
'prefer-object-spread': true,
Expand All @@ -39,19 +48,27 @@ const commonRules = {
module.exports = {
extends: ['tslint:recommended', 'tslint-config-prettier'],
jsRules: commonRules,
lintOptions: {
typeCheck: true
linterOptions: {
exclude: [
'node_modules',
'dist',
'coverage',
'dev'
]
},
rules: {
...commonRules,
'await-promise': true,
'interface-name': [true, 'never-prefix'],
'no-any': true,
'no-floating-promises': true,
'no-inferrable-types': false,
'no-non-null-assertion': true,
'no-unused-variable': true,
'promise-function-async': true,
'restrict-plus-operands': true
}
rules: Object.assign(
{},
commonRules,
{
'await-promise': true,
'interface-name': [true, 'never-prefix'],
'no-any': true,
'no-floating-promises': true,
'no-inferrable-types': false,
'no-non-null-assertion': true,
'no-unused-variable': true,
'promise-function-async': true,
'restrict-plus-operands': true
}
)
};
12 changes: 8 additions & 4 deletions react.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
/* tslint:disable:prefer-object-spread */
const commonRules = {
'jsx-alignment': false,
'jsx-equals-spacing': false,
Expand All @@ -11,8 +12,11 @@ const commonRules = {
module.exports = {
extends: ['tslint-react'],
jsRules: commonRules,
rules: {
...commonRules,
'jsx-curly-spacing': false
}
rules: Object.assign(
{},
commonRules,
{
'jsx-curly-spacing': false
}
)
};

0 comments on commit e249c2d

Please sign in to comment.