Skip to content

Commit

Permalink
feat(eslint): migrate rest of custom rules to eslint (#24)
Browse files Browse the repository at this point in the history
* feat(eslint): migrate rest of custom rules to eslint

* docs: update roadmap
  • Loading branch information
Dmitry Naumov authored and MarsiBarsi committed Nov 23, 2019
1 parent f141671 commit 20d24cb
Show file tree
Hide file tree
Showing 18 changed files with 12,980 additions and 561 deletions.
1 change: 1 addition & 0 deletions .eslintignore
@@ -0,0 +1 @@
*.fixture.*
4 changes: 1 addition & 3 deletions ROADMAP.md
@@ -1,13 +1,11 @@
### 1.0.0
- Introducing eslint
- Warnings about changes by new code style
- Migration of `tinkoff-` rules natively to eslint

### 1.1.0
- Same errors (backwards compatible) and new warnings for angular and rxjs

### 1.1.1
- Migration of `tinkoff-` rules natively to eslint

### 2.0.0
- Completely removing tslint rules and configs
- Warnings from v1.* turns into errors in accordance with new code style, angular and rxjs
Expand Down
29 changes: 29 additions & 0 deletions eslint/angular/conventions.js
@@ -1,7 +1,36 @@
const breaking = require('../utils/breaking');

module.exports = {
rules: {
'@typescript-eslint/class-name-casing': 'error',

'@typescript-eslint/member-ordering': 'off',
'@tinkoff/member-ordering': [
breaking({since: 2}),
{
classes: [
'private-instance-field',
'private-static-field',
'protected-static-field',
'protected-instance-field',
'public-instance-field',
'public-static-field',
'@Input',
'@Output',
'public-instance-get',
'public-instance-set',
'protected-instance-get',
'protected-instance-set',
'private-instance-get',
'private-instance-set',
'public-instance-method',
'public-static-method',
'protected-instance-method',
'protected-static-method',
'private-instance-method',
'private-static-method',
],
},
],
},
};
19 changes: 1 addition & 18 deletions eslint/common/typescript/conventions.js
@@ -1,4 +1,3 @@
const path = require('path');
const breaking = require('../../utils/breaking');

module.exports = {
Expand Down Expand Up @@ -39,22 +38,6 @@ module.exports = {
before: 'off',
after: 'warn',
}),
'@typescript-eslint/explicit-function-return-type': 'off',

// Runs an instance of TSLint within your ESLint setup
// https://github.com/typescript-eslint/typescript-eslint/tree/master/packages/eslint-plugin-tslint
'@typescript-eslint/tslint/config': [
breaking({since: 2}), // 'tinkoff-angular-member-ordering' was recently changed
{
rules: {
eofline: true, // Dummy rule to supress "Tried to lint [file] but found no valid, enabled rules for this file type and file path in the resolved configuration."
'tinkoff-method-return-type': true,
'tinkoff-new-line-after-variable-declaration': true,
// 'tinkoff-new-line-around-control-statement': true, // replaced with padding-line-between-statements
'tinkoff-angular-member-ordering': true,
},
rulesDirectory: [path.join(__dirname, '../../../tslint/rules')],
},
],
'@tinkoff/require-return-type': 'error',
},
};
7 changes: 6 additions & 1 deletion eslint/common/typescript/enviroment.js
Expand Up @@ -7,5 +7,10 @@ module.exports = {
project: './tsconfig.json',
sourceType: 'module',
},
plugins: ['@typescript-eslint', '@typescript-eslint/tslint', 'functional'],
plugins: [
'@typescript-eslint',
'@typescript-eslint/tslint',
'functional',
'@tinkoff',
],
};
6 changes: 6 additions & 0 deletions eslint/rules/index.js
@@ -0,0 +1,6 @@
module.exports = {
rules: {
'member-ordering': require('./member-ordering'),
'require-return-type': require('./require-return-type'),
},
};

0 comments on commit 20d24cb

Please sign in to comment.