-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactored code and added new flat config for eslint
- Loading branch information
Showing
12 changed files
with
380 additions
and
334 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,86 @@ | ||
"use strict" | ||
|
||
import eslintRecommended from '@eslint/js'; | ||
import tsEslintRecommended from '@typescript-eslint/eslint-plugin'; | ||
import tsEslintParser from '@typescript-eslint/parser'; | ||
import importPlugin from 'eslint-plugin-import'; | ||
|
||
/** @type {import("eslint").Linter.Config[]} */ | ||
export default [ | ||
{ | ||
files: ['*.ts', '*.tsx'], | ||
languageOptions: { | ||
parser: tsEslintParser, | ||
}, | ||
plugins: { | ||
'@typescript-eslint': tsEslintRecommended, | ||
import: importPlugin, | ||
}, | ||
rules: { | ||
...eslintRecommended.configs.recommended.rules, | ||
...tsEslintRecommended.configs['eslint-recommended'].rules, | ||
...tsEslintRecommended.configs.recommended.rules, | ||
...importPlugin.configs.recommended.rules, | ||
|
||
'@typescript-eslint/no-empty-function': 'off', | ||
'no-restricted-syntax': 'off', // В for...of циклах ничего плохого нет | ||
'spaced-comment': ['error', 'always', { markers: ['/'] }], // разрешаем ts-require directive | ||
'comma-dangle': ['error', 'always-multiline'], | ||
'arrow-parens': ['error', 'always'], | ||
|
||
'space-before-function-paren': [ | ||
'error', | ||
{ | ||
anonymous: 'never', | ||
named: 'never', | ||
asyncArrow: 'always', | ||
}, | ||
], | ||
indent: 'off', | ||
'max-len': [ | ||
'error', | ||
120, | ||
2, | ||
{ | ||
ignoreUrls: true, | ||
ignoreComments: false, | ||
ignoreRegExpLiterals: true, | ||
ignoreStrings: true, | ||
ignoreTemplateLiterals: true, | ||
}, | ||
], | ||
'padding-line-between-statements': [ | ||
'error', | ||
{ blankLine: 'always', prev: '*', next: 'return' }, | ||
{ blankLine: 'always', prev: '*', next: 'if' }, | ||
], | ||
'implicit-arrow-linebreak': 'off', | ||
'no-plusplus': 'off', | ||
'max-classes-per-file': 'off', | ||
'operator-linebreak': 'off', | ||
'object-curly-newline': 'off', | ||
'class-methods-use-this': 'off', | ||
'no-confusing-arrow': 'off', | ||
'function-paren-newline': 'off', | ||
'no-param-reassign': 'off', | ||
'no-shadow': 'warn', | ||
'consistent-return': 'off', | ||
|
||
'@typescript-eslint/explicit-function-return-type': 'off', | ||
|
||
'import/prefer-default-export': 'off', // @grape: https://humanwhocodes.com/blog/2019/01/stop-using-default-exports-javascript-module/ | ||
'import/order': [ | ||
'error', | ||
{ | ||
groups: [['builtin', 'external'], 'internal', 'parent', 'sibling', 'index'], | ||
'newlines-between': 'always', | ||
}, | ||
], | ||
'import/no-unresolved': 'off', | ||
'import/extensions': 'off', | ||
'import/no-extraneous-dependencies': ['off'], | ||
'arrow-body-style': 'off', | ||
'no-unused-expressions': 'off', | ||
}, | ||
}, | ||
]; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,86 +1,71 @@ | ||
"use strict" | ||
export default { | ||
extends: [ | ||
'eslint:recommended', | ||
'plugin:@typescript-eslint/eslint-recommended', | ||
'plugin:@typescript-eslint/recommended', | ||
'plugin:import/recommended', | ||
], | ||
parser: '@typescript-eslint/parser', | ||
plugins: ['@typescript-eslint'], | ||
rules: { | ||
'@typescript-eslint/no-empty-function': 'off', | ||
'no-restricted-syntax': 'off', // В for...of циклах ничего плохого нет | ||
'spaced-comment': ['error', 'always', { markers: ['/'] }], /// разрешаем ts-require directive | ||
'comma-dangle': ['error', 'always-multiline'], | ||
'arrow-parens': ['error', 'always'], | ||
|
||
import eslintRecommended from 'eslint/conf/eslint-recommended'; | ||
import tsEslintRecommended from '@typescript-eslint/eslint-plugin'; | ||
import tsEslintParser from '@typescript-eslint/parser'; | ||
import importPlugin from 'eslint-plugin-import'; | ||
'space-before-function-paren': [ | ||
'error', | ||
{ | ||
anonymous: 'never', | ||
named: 'never', | ||
asyncArrow: 'always', | ||
}, | ||
], | ||
indent: 'off', | ||
'max-len': [ | ||
'error', | ||
120, | ||
2, | ||
{ | ||
ignoreUrls: true, | ||
ignoreComments: false, | ||
ignoreRegExpLiterals: true, | ||
ignoreStrings: true, | ||
ignoreTemplateLiterals: true, | ||
}, | ||
], | ||
'padding-line-between-statements': [ | ||
'error', | ||
{ blankLine: 'always', prev: '*', next: 'return' }, | ||
{ blankLine: 'always', prev: '*', next: 'if' }, | ||
], | ||
'implicit-arrow-linebreak': 'off', | ||
'no-plusplus': 'off', | ||
'max-classes-per-file': 'off', | ||
'operator-linebreak': 'off', | ||
'object-curly-newline': 'off', | ||
'class-methods-use-this': 'off', | ||
'no-confusing-arrow': 'off', | ||
'function-paren-newline': 'off', | ||
'no-param-reassign': 'off', | ||
'no-shadow': 'warn', | ||
'consistent-return': 'off', | ||
|
||
/** @type {import("eslint").Linter.Config[]} */ | ||
export default [ | ||
{ | ||
files: ['*.ts', '*.tsx'], | ||
languageOptions: { | ||
parser: tsEslintParser, | ||
}, | ||
plugins: { | ||
'@typescript-eslint': tsEslintRecommended, | ||
import: importPlugin, | ||
}, | ||
rules: { | ||
...eslintRecommended.rules, | ||
...tsEslintRecommended.configs['eslint-recommended'].rules, | ||
...tsEslintRecommended.configs.recommended.rules, | ||
...importPlugin.configs.recommended.rules, | ||
'@typescript-eslint/explicit-function-return-type': 'off', | ||
|
||
'@typescript-eslint/no-empty-function': 'off', | ||
'no-restricted-syntax': 'off', // В for...of циклах ничего плохого нет | ||
'spaced-comment': ['error', 'always', { markers: ['/'] }], // разрешаем ts-require directive | ||
'comma-dangle': ['error', 'always-multiline'], | ||
'arrow-parens': ['error', 'always'], | ||
|
||
'space-before-function-paren': [ | ||
'error', | ||
{ | ||
anonymous: 'never', | ||
named: 'never', | ||
asyncArrow: 'always', | ||
}, | ||
], | ||
indent: 'off', | ||
'max-len': [ | ||
'error', | ||
120, | ||
2, | ||
{ | ||
ignoreUrls: true, | ||
ignoreComments: false, | ||
ignoreRegExpLiterals: true, | ||
ignoreStrings: true, | ||
ignoreTemplateLiterals: true, | ||
}, | ||
], | ||
'padding-line-between-statements': [ | ||
'error', | ||
{ blankLine: 'always', prev: '*', next: 'return' }, | ||
{ blankLine: 'always', prev: '*', next: 'if' }, | ||
], | ||
'implicit-arrow-linebreak': 'off', | ||
'no-plusplus': 'off', | ||
'max-classes-per-file': 'off', | ||
'operator-linebreak': 'off', | ||
'object-curly-newline': 'off', | ||
'class-methods-use-this': 'off', | ||
'no-confusing-arrow': 'off', | ||
'function-paren-newline': 'off', | ||
'no-param-reassign': 'off', | ||
'no-shadow': 'warn', | ||
'consistent-return': 'off', | ||
|
||
'@typescript-eslint/explicit-function-return-type': 'off', | ||
|
||
'import/prefer-default-export': 'off', // @grape: https://humanwhocodes.com/blog/2019/01/stop-using-default-exports-javascript-module/ | ||
'import/order': [ | ||
'error', | ||
{ | ||
groups: [['builtin', 'external'], 'internal', 'parent', 'sibling', 'index'], | ||
'newlines-between': 'always', | ||
}, | ||
], | ||
'import/no-unresolved': 'off', | ||
'import/extensions': 'off', | ||
'import/no-extraneous-dependencies': ['off'], | ||
'arrow-body-style': 'off', | ||
'no-unused-expressions': 'off', | ||
}, | ||
'import/prefer-default-export': 'off', // @grape: https://humanwhocodes.com/blog/2019/01/stop-using-default-exports-javascript-module/ | ||
'import/order': [ | ||
'error', | ||
{ | ||
groups: [['builtin', 'external'], 'internal', 'parent', 'sibling', 'index'], | ||
'newlines-between': 'always', | ||
}, | ||
], | ||
'import/no-unresolved': 'off', | ||
'import/extensions': 'off', | ||
'import/no-extraneous-dependencies': ['off'], | ||
'arrow-body-style': 'off', | ||
'no-unused-expressions': 'off', | ||
}, | ||
]; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -10,8 +10,11 @@ | |
"author": "Salute Frontend Team <[email protected]>", | ||
"main": "index.js", | ||
"exports": { | ||
".": "./index.js", | ||
"./flat": "./index.mjs" | ||
".": { | ||
"require": "./index.js", | ||
"import": "./index.mjs" | ||
}, | ||
"./flat": "./flat/index.mjs" | ||
}, | ||
"peerDependencies": { | ||
"@typescript-eslint/eslint-plugin": ">=8", | ||
|
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.