FRONTEND-233: Init eslint plugin (#11)

This commit is contained in:
Rinat Arsaev 2021-04-26 16:14:06 +03:00 committed by GitHub
parent 19cf7de4dd
commit 3a1e6211b2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
12 changed files with 1704 additions and 398 deletions

1
.gitignore vendored
View File

@ -1,3 +1,2 @@
node_modules
lib
.idea

1913
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,3 @@
package.json
package-lock.json
node_modules

View File

@ -0,0 +1,26 @@
{
"plugins": ["import"],
"extends": ["plugin:import/errors", "plugin:import/warnings", "plugin:import/typescript"],
"rules": {
"import/no-unresolved": "off",
"import/namespace": "off",
"import/order": [
"error",
{
"groups": [["builtin", "external"], "internal", ["parent", "sibling", "index"], "object"],
"pathGroups": [
{
"pattern": "@dsh/**",
"group": "internal"
}
],
"pathGroupsExcludedImportTypes": ["builtin"],
"newlines-between": "always",
"alphabetize": {
"order": "asc",
"caseInsensitive": true
}
}
]
}
}

View File

@ -0,0 +1,32 @@
'use strict';
module.exports = {
configs: {
typescript: require('./typescript.js'),
angular: {
plugins: ['@angular-eslint', 'import', '@typescript-eslint'],
extends: [
'plugin:@angular-eslint/recommended',
'plugin:@angular-eslint/template/process-inline-templates',
require.resolve('./typescript.js'),
],
},
jasmine: {
plugins: ['jasmine'],
extends: ['plugin:jasmine/recommended'],
rules: {
'jasmine/new-line-before-expect': 'off',
},
},
lodash: {
plugins: ['you-dont-need-lodash-underscore'],
extends: ['plugin:you-dont-need-lodash-underscore/compatible'],
rules: {
'you-dont-need-lodash-underscore/is-nil': 'off',
},
},
prettier: {
extends: ['prettier'],
},
},
};

View File

@ -0,0 +1,72 @@
'use strict';
module.exports = {
plugins: ['@typescript-eslint'],
extends: [
'eslint:recommended',
'plugin:@typescript-eslint/recommended',
'plugin:@typescript-eslint/recommended-requiring-type-checking',
require.resolve('./import.json'),
require.resolve('./unused-imports.json'),
],
rules: {
'no-console': ['error', { allow: ['warn', 'error'] }],
'no-restricted-imports': [
'error',
{
paths: ['rxjs/Rx', 'rxjs/internal', 'lodash', 'lodash-es', '.'],
patterns: ['src/*'],
},
],
'@typescript-eslint/no-unused-expressions': 'error',
'@typescript-eslint/no-inferrable-types': 'off',
'@typescript-eslint/member-ordering': [
'error',
{
default: [
'signature',
'public-field',
'protected-field',
'private-field',
'constructor',
'public-method',
'protected-method',
'private-method',
],
},
],
'@typescript-eslint/naming-convention': [
'error',
{
selector: 'default',
// TODO: strictCamelCase
format: ['camelCase'],
leadingUnderscore: 'allow',
},
{
selector: 'typeLike',
format: ['StrictPascalCase'],
},
{
selector: 'variable',
modifiers: ['const', 'global'],
format: ['UPPER_CASE'],
},
{
selector: 'variable',
modifiers: ['const', 'global'],
// Objects are functions too
types: ['function'],
format: ['UPPER_CASE', 'strictCamelCase'],
},
{
selector: 'enumMember',
format: ['StrictPascalCase'],
},
],
},
};

View File

@ -0,0 +1,16 @@
{
"plugins": ["@typescript-eslint", "unused-imports"],
"rules": {
"@typescript-eslint/no-unused-vars": "off",
"unused-imports/no-unused-imports": "error",
"unused-imports/no-unused-vars": [
"error",
{
"vars": "all",
"varsIgnorePattern": "^_",
"args": "after-used",
"argsIgnorePattern": "^_"
}
]
}
}

View File

@ -0,0 +1,31 @@
{
"name": "@rbkmoney/eslint-plugin",
"version": "0.1.0-pr.0",
"description": "ESLint Configs",
"author": "rbkmoney",
"main": "lib/index",
"types": "lib/index",
"files": [
"lib"
],
"scripts": {},
"repository": {
"type": "git",
"url": "https://github.com/rbkmoney/fe-core"
},
"publishConfig": {
"registry": "https://npm.pkg.github.com/@rbkmoney"
},
"dependencies": {
"@angular-eslint/eslint-plugin": "^4.0.0",
"@angular-eslint/eslint-plugin-template": "^4.0.0",
"@typescript-eslint/eslint-plugin": "^4.22.0",
"eslint-config-prettier": "^8.3.0",
"eslint-plugin-import": "^2.22.1",
"eslint-plugin-jasmine": "^4.1.2",
"eslint-plugin-jsdoc": "^32.3.1",
"eslint-plugin-prefer-arrow": "^1.2.3",
"eslint-plugin-unused-imports": "^1.1.1",
"eslint-plugin-you-dont-need-lodash-underscore": "^6.11.0"
}
}

1
packages/partial-fetcher/.gitignore vendored Normal file
View File

@ -0,0 +1 @@
lib

View File

@ -1,6 +1,6 @@
{
"name": "@rbkmoney/partial-fetcher",
"version": "0.4.0",
"version": "0.4.1-pr.0",
"description": "Partial Fetcher",
"author": "rbkmoney",
"main": "lib/index",
@ -25,6 +25,6 @@
"rxjs": "^6.0.0"
},
"dependencies": {
"@rbkmoney/utils": "^0.4.0"
"@rbkmoney/utils": "^0.4.1-pr.0"
}
}

1
packages/utils/.gitignore vendored Normal file
View File

@ -0,0 +1 @@
lib

View File

@ -1,6 +1,6 @@
{
"name": "@rbkmoney/utils",
"version": "0.4.0",
"version": "0.4.1-pr.0",
"description": "Utils",
"author": "rbkmoney",
"main": "lib/index",