Skip to content

Commit

Permalink
Merge pull request #144 from ttsukagoshi/prettier-settings
Browse files Browse the repository at this point in the history
Update Prettier settings to v3 default
  • Loading branch information
ttsukagoshi authored Feb 5, 2024
2 parents 25da702 + 3db94de commit e9c3de8
Show file tree
Hide file tree
Showing 8 changed files with 70 additions and 65 deletions.
30 changes: 15 additions & 15 deletions .github/workflows/codeql.yml
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
name: "CodeQL"
name: 'CodeQL'

on:
push:
branches: [ "main" ]
branches: ['main']
pull_request:
# The branches below must be a subset of the branches above
branches: [ "main" ]
branches: ['main']

jobs:
analyze:
Expand All @@ -19,19 +19,19 @@ jobs:
strategy:
fail-fast: false
matrix:
language: [ 'javascript' ]
language: ['javascript']

steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Checkout repository
uses: actions/checkout@v4

# Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL
uses: github/codeql-action/init@v3
with:
languages: ${{ matrix.language }}
# Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL
uses: github/codeql-action/init@v3
with:
languages: ${{ matrix.language }}

- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v3
with:
category: "/language:${{matrix.language}}"
- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v3
with:
category: '/language:${{matrix.language}}'
1 change: 1 addition & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
LICENSE
node_modules/
2 changes: 1 addition & 1 deletion .prettierrc
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"tabWidth": 2,
"semi": true,
"trailingComma": "es5",
"trailingComma": "all",
"singleQuote": true,
"endOfLine": "lf"
}
20 changes: 12 additions & 8 deletions __tests__/deepL.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ const deepLTranslatePatterns: DeepLTranslatePattern[] = [
},
expectedOutput: [
`${translateUrl}?auth_key=${mockApiKey}&target_lang=EN-US&text=${encodeURIComponent(
'text to translate'
'text to translate',
)}&source_lang=JA`,
],
},
Expand All @@ -107,9 +107,9 @@ const deepLTranslatePatterns: DeepLTranslatePattern[] = [
},
expectedOutput: [
`${translateUrl}?auth_key=${mockApiKey}&target_lang=EN-US&text=${encodeURIComponent(
'text to translate 1'
'text to translate 1',
)}&text=${encodeURIComponent(
'text to translate 2'
'text to translate 2',
)}&text=${encodeURIComponent('text to translate 3')}&source_lang=JA`,
],
},
Expand Down Expand Up @@ -177,10 +177,14 @@ describe.each(deepLTranslatePatterns)(
({ title, input, expectedOutput }) => {
test(`deepLTranslate test: ${title}`, () => {
expect(
deepLTranslate(input.sourceText, input.sourceLocale, input.targetLocale)
deepLTranslate(
input.sourceText,
input.sourceLocale,
input.targetLocale,
),
).toEqual(expectedOutput);
});
}
},
);

// Error patterns in deepLTranslate
Expand All @@ -192,11 +196,11 @@ describe.each(deepLTranslatePatternsWithErrors)(
deepLTranslate(
input.sourceText,
input.sourceLocale,
input.targetLocale
input.targetLocale,
);
}).toThrowError(new Error(`[${ADDON_NAME}] Empty input.`));
});
}
},
);

describe.each(deepLGetLanguagesPatterns)(
Expand All @@ -205,5 +209,5 @@ describe.each(deepLGetLanguagesPatterns)(
test(`deepLGetLanguages test: ${title}`, () => {
expect(deepLGetLanguages(input)).toEqual(expectedOutput);
});
}
},
);
2 changes: 1 addition & 1 deletion __tests__/getDeepLApiBaseUrl.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,5 +23,5 @@ describe.each(patterns)(
test(`getDeepLApiBaseUrl test: ${title}`, () => {
expect(getDeepLApiBaseUrl(input)).toBe(expectedOutput);
});
}
},
);
2 changes: 1 addition & 1 deletion __tests__/handleDeepLErrors.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -66,5 +66,5 @@ describe.each(errorPatterns)(
handleDeepLErrors(inputResponse);
}).toThrowError(new Error(expectedErrorMessage));
});
}
},
);
8 changes: 4 additions & 4 deletions __tests__/verifyAuthKeyPrompt.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -77,15 +77,15 @@ describe.each(verifyAuthKeyPromptSuccessPatterns)(
({ testName, input, expectedOutput }) => {
test(`${testName}: getSelectedButton`, () => {
expect(
verifyAuthKeyPrompt(input.promptResponse, input.ui).getSelectedButton()
verifyAuthKeyPrompt(input.promptResponse, input.ui).getSelectedButton(),
).toBe(expectedOutput.getSelectedButton());
});
test(`${testName}: getResponseText`, () => {
expect(
verifyAuthKeyPrompt(input.promptResponse, input.ui).getResponseText()
verifyAuthKeyPrompt(input.promptResponse, input.ui).getResponseText(),
).toBe(expectedOutput.getResponseText());
});
}
},
);

describe.each(verifyAuthKeyPromptErrorPatterns)(
Expand All @@ -96,5 +96,5 @@ describe.each(verifyAuthKeyPromptErrorPatterns)(
verifyAuthKeyPrompt(input.promptResponse, input.ui);
}).toThrowError(new Error(expectedErrorMessage));
});
}
},
);
Loading

0 comments on commit e9c3de8

Please sign in to comment.