-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #2691 from exadel-inc/chore/unite-eslint-rules
chore(lint): unite eslint rules
- Loading branch information
Showing
19 changed files
with
114 additions
and
162 deletions.
There are no files selected for viewing
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
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 |
---|---|---|
@@ -1,21 +1,11 @@ | ||
import deprecatedGenerateUid from './deprecated.generate-uid'; | ||
import deprecatedDeepCompare from './deprecated.deep-compare'; | ||
import deprecatedEventUtils from './deprecated.event-utils'; | ||
import deprecatedTraversingQuery from './deprecated.traversing-query'; | ||
import deprecatedToggleableActionParams from './deprecated.toggleable-action-params'; | ||
import deprecatedAliases from './deprecated.aliases'; | ||
|
||
import deprecatedBaseDecoratorsPath from './deprecated.base-decorators-path'; | ||
import deprecatedMethods from './deprecated.class-methods'; | ||
|
||
import deprecatedMediaRuleListParse from './deprecated.media-rule-list-parse'; | ||
import deprecatedImports from './deprecated.import'; | ||
|
||
export default { | ||
// Aliases | ||
'deprecated-4-generate-uid': deprecatedGenerateUid, | ||
'deprecated-4-deep-compare': deprecatedDeepCompare, | ||
'deprecated-4-event-utils': deprecatedEventUtils, | ||
'deprecated-4-traversing-query': deprecatedTraversingQuery, | ||
'deprecated-4-toggleable-action-params': deprecatedToggleableActionParams, | ||
'deprecated-4-media-rule-list-parse': deprecatedMediaRuleListParse, | ||
// Paths | ||
'deprecated-4-base-decorators-path': deprecatedBaseDecoratorsPath | ||
'deprecated-4-aliases': deprecatedAliases, | ||
'deprecated-4-class-methods': deprecatedMethods, | ||
'deprecated-4-import': deprecatedImports | ||
}; |
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,23 @@ | ||
import {buildRule} from '../../core/deprecated-alias'; | ||
|
||
/** | ||
* Rule for deprecated aliases | ||
*/ | ||
export default buildRule([ | ||
{ | ||
alias: 'ESLEventUtils', | ||
deprecation: 'EventUtils' | ||
}, { | ||
alias: 'isEqual', | ||
deprecation: 'deepCompare' | ||
}, { | ||
alias: 'ESLToggleableActionParams', | ||
deprecation: 'ToggleableActionParams' | ||
}, { | ||
alias: 'randUID', | ||
deprecation: 'generateUId' | ||
}, { | ||
alias: 'ESLTraversingQuery', | ||
deprecation: 'TraversingQuery' | ||
} | ||
]); |
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,29 @@ | ||
import {lte} from 'semver'; | ||
import {ESL_PACKAGE_VERSION} from '../../core/check-version'; | ||
import {buildRule} from '../../core/deprecated-class-method'; | ||
|
||
import type * as ESTree from 'estree'; | ||
import type {ESLintReplacementMethodCfg} from '../../core/deprecated-class-method'; | ||
|
||
const AVAILABLE_SINCE = '5.0.0-beta.24'; | ||
const isActual = lte(ESL_PACKAGE_VERSION, AVAILABLE_SINCE); | ||
|
||
/** | ||
* Rule for deprecated methods | ||
*/ | ||
export default buildRule({ | ||
className: 'ESLMediaRuleList', | ||
deprecatedMethod: 'parse', | ||
getReplacementMethod: (expression): ESLintReplacementMethodCfg | string => { | ||
const args = expression.arguments; | ||
const isLiteral = (node: ESTree.Expression | ESTree.SpreadElement): boolean => node?.type === 'Literal' || node?.type === 'TemplateLiteral'; | ||
if (expression.type === 'CallExpression' && args.length === 1) return 'parseQuery'; | ||
if (expression.type === 'CallExpression' && args.length === 2 && isLiteral(args[1])) return 'parseTuple'; | ||
if (expression.type === 'CallExpression' && args.length === 3) return 'parseTuple'; | ||
return {message: 'ESLMediaRuleList.parseQuery or ESLMediaRuleList.parseTuple'}; | ||
}, | ||
skipOn: { | ||
actual: isActual, | ||
message: `'ESLMediaRuleList.parse' was updated in v${AVAILABLE_SINCE}. Rule 'deprecated-4/media-rule-list-parse' is skipped.` | ||
} | ||
}); |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
File renamed without changes.
28 changes: 0 additions & 28 deletions
28
eslint-plugin/src/rules/4/deprecated.media-rule-list-parse.ts
This file was deleted.
Oops, something went wrong.
9 changes: 0 additions & 9 deletions
9
eslint-plugin/src/rules/4/deprecated.toggleable-action-params.ts
This file was deleted.
Oops, something went wrong.
This file was deleted.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,5 @@ | ||
import deprecatedAlertActionParams from './deprecated.alert-action-params'; | ||
import deprecatedPanelActionParams from './deprecated.panel-action-params'; | ||
import deprecatedPopupActionParams from './deprecated.popup-action-params'; | ||
import deprecatedTooltipActionParams from './deprecated.tooltip-action-params'; | ||
import deprecatedAliases from './deprecated.aliases'; | ||
|
||
export default { | ||
'deprecated-5-alert-action-params': deprecatedAlertActionParams, | ||
'deprecated-5-panel-action-params': deprecatedPanelActionParams, | ||
'deprecated-5-popup-action-params': deprecatedPopupActionParams, | ||
'deprecated-5-tooltip-action-params': deprecatedTooltipActionParams | ||
'deprecated-5-aliases': deprecatedAliases, | ||
}; |
This file was deleted.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
import {buildRule} from '../../core/deprecated-alias'; | ||
|
||
/** | ||
* Rule for deprecated aliases | ||
*/ | ||
export default buildRule([ | ||
{ | ||
alias: 'ESLAlertActionParams', | ||
deprecation: 'AlertActionParams' | ||
}, { | ||
alias: 'ESLPanelActionParams', | ||
deprecation: 'PanelActionParams' | ||
}, { | ||
alias: 'ESLPopupActionParams', | ||
deprecation: 'PopupActionParams' | ||
}, { | ||
alias: 'ESLTooltipActionParams', | ||
deprecation: 'TooltipActionParams' | ||
} | ||
]); |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
10 changes: 0 additions & 10 deletions
10
eslint-plugin/src/rules/5/deprecated.tooltip-action-params.ts
This file was deleted.
Oops, something went wrong.