Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ESLint Config Migration: Allow unused vars with leading underscores #1045

Merged
merged 1 commit into from
Aug 23, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
18 changes: 10 additions & 8 deletions .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -190,21 +190,26 @@ module.exports = {
// both purposes, and it works fine on non-TypeScript code.
camelcase: 'off',
'no-underscore-dangle': 'off',
'@typescript-eslint/no-unused-vars': [
'error',
{
varsIgnorePattern: '^_',
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

argsIgnorePattern: '^_'
}
],
'@typescript-eslint/naming-convention': [
'error',
{
selector: 'default',
format: ['camelCase'],
filter: {
regex: '^_',
match: false
},
leadingUnderscore: 'allow',
},
{
selector: 'variable',
// PascalCase for variables is added to allow exporting a singleton, function library, or bare object as in
// section 23.8 of the AirBnB style guide
format: ['camelCase', 'PascalCase', 'UPPER_CASE', 'snake_case'],
leadingUnderscore: 'allow',
},
{
selector: 'parameter',
Expand All @@ -214,10 +219,7 @@ module.exports = {
{
selector: 'typeLike',
format: ['PascalCase', 'camelCase'],
filter: {
regex: '^_',
match: false
},
leadingUnderscore: 'allow',
},
{
selector: 'typeProperty',
Expand Down
2 changes: 1 addition & 1 deletion src/WorkflowStep.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -291,7 +291,7 @@ describe('WorkflowStep', () => {

describe('processStepMiddleware', () => {
it('should call each callback in user-provided middleware', async () => {
const { next, ...fakeArgs } = createFakeStepEditAction() as unknown as AllWorkflowStepMiddlewareArgs;
const { next: _next, ...fakeArgs } = createFakeStepEditAction() as unknown as AllWorkflowStepMiddlewareArgs;
const { processStepMiddleware } = await importWorkflowStep();

const fn1 = sinon.spy((async ({ next: continuation }) => {
Expand Down
2 changes: 1 addition & 1 deletion src/WorkflowStep.ts
Original file line number Diff line number Diff line change
Expand Up @@ -347,7 +347,7 @@ function createStepFail(args: AllWorkflowStepMiddlewareArgs<WorkflowStepExecuteM
* */
// TODO :: refactor to incorporate a generic parameter
export function prepareStepArgs(args: any): AllWorkflowStepMiddlewareArgs {
const { next, ...stepArgs } = args;
const { next: _next, ...stepArgs } = args;
const preparedArgs: any = { ...stepArgs };

switch (preparedArgs.payload.type) {
Expand Down