mirror of
https://github.com/valitydev/fe-core.git
synced 2024-11-06 02:25:18 +00:00
FRONTEND-233: Init eslint plugin (#11)
This commit is contained in:
parent
19cf7de4dd
commit
3a1e6211b2
1
.gitignore
vendored
1
.gitignore
vendored
@ -1,3 +1,2 @@
|
||||
node_modules
|
||||
lib
|
||||
.idea
|
1913
package-lock.json
generated
1913
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
3
packages/eslint-plugin/.prettierignore
Normal file
3
packages/eslint-plugin/.prettierignore
Normal file
@ -0,0 +1,3 @@
|
||||
package.json
|
||||
package-lock.json
|
||||
node_modules
|
26
packages/eslint-plugin/lib/import.json
Normal file
26
packages/eslint-plugin/lib/import.json
Normal 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
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
32
packages/eslint-plugin/lib/index.js
Normal file
32
packages/eslint-plugin/lib/index.js
Normal 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'],
|
||||
},
|
||||
},
|
||||
};
|
72
packages/eslint-plugin/lib/typescript.js
Normal file
72
packages/eslint-plugin/lib/typescript.js
Normal 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'],
|
||||
},
|
||||
],
|
||||
},
|
||||
};
|
16
packages/eslint-plugin/lib/unused-imports.json
Normal file
16
packages/eslint-plugin/lib/unused-imports.json
Normal 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": "^_"
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
31
packages/eslint-plugin/package.json
Normal file
31
packages/eslint-plugin/package.json
Normal 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
1
packages/partial-fetcher/.gitignore
vendored
Normal file
@ -0,0 +1 @@
|
||||
lib
|
@ -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
1
packages/utils/.gitignore
vendored
Normal file
@ -0,0 +1 @@
|
||||
lib
|
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@rbkmoney/utils",
|
||||
"version": "0.4.0",
|
||||
"version": "0.4.1-pr.0",
|
||||
"description": "Utils",
|
||||
"author": "rbkmoney",
|
||||
"main": "lib/index",
|
||||
|
Loading…
Reference in New Issue
Block a user