-
Notifications
You must be signed in to change notification settings - Fork 4
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
fix: update unicorn preset to 56, update prettier to v3 #248
Merged
Merged
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
2c8ef6c
fix: update eslint-plugin-sonarjs to v2.0.3, @trivago/prettier-plugin…
antongolub 0b239c2
fix: update eslint-plugin-unicorn to v56
antongolub 2782794
ci: fix artifact path
antongolub c7c66ff
fix: enable @trivago/prettier-plugin-sort-imports
antongolub b2935bf
fix(prettier): use prettier v3
antongolub File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
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 |
---|---|---|
|
@@ -25,7 +25,7 @@ export const bar = (foo) => { | |
} | ||
|
||
if (sw === -0) { | ||
sw = 071 | ||
sw = 0o71 | ||
function declaration() { } | ||
} | ||
|
||
|
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 |
---|---|---|
|
@@ -29,19 +29,19 @@ | |
"author": "QIWI <[email protected]>", | ||
"license": "MIT", | ||
"dependencies": { | ||
"@trivago/prettier-plugin-sort-imports": "^4.1.1" | ||
"@trivago/prettier-plugin-sort-imports": "^4.3.0" | ||
}, | ||
"peerDependencies": { | ||
"prettier": "^2.0.0", | ||
"prettier": "^3.0.0", | ||
"typescript": "^5.0.0" | ||
}, | ||
"devDependencies": { | ||
"@qiwi/lint-config-infra": "2.1.1", | ||
"@swissquote/crafty-preset-jest": "^1.22.3", | ||
"jest": "^29.5.0", | ||
"prettier": "^2.8.8", | ||
"@swissquote/crafty-preset-jest": "^1.27.0", | ||
"jest": "^29.7.0", | ||
"prettier": "^3.3.3", | ||
"stdstream-snapshot": "^1.2.9", | ||
"ts-jest": "^29.1.0", | ||
"typescript": "^5.0.4" | ||
"ts-jest": "^29.2.5", | ||
"typescript": "^5.6.3" | ||
} | ||
} |
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,44 +1,23 @@ | ||
import { execSync } from 'node:child_process' | ||
import { | ||
copyFileSync, | ||
existsSync, | ||
mkdirSync, | ||
readFileSync, | ||
rmdirSync, | ||
} from 'node:fs' | ||
import { resolve } from 'node:path' | ||
|
||
import * as cp from 'node:child_process' | ||
import * as fs from 'node:fs' | ||
import * as path from 'node:path' | ||
import * as prettierConfig from '../../main/js' | ||
|
||
describe('', () => { | ||
const tmpDir = resolve(__dirname, '../../../../../tmp') | ||
|
||
beforeAll(() => { | ||
if (existsSync(tmpDir)) { | ||
rmdirSync(tmpDir, { recursive: true }) | ||
} | ||
mkdirSync(tmpDir) | ||
}) | ||
const root = path.resolve(__dirname, '../../../../../') | ||
const pkgRoot = path.resolve(root, 'packages/prettier-config-qiwi') | ||
const bin = path.resolve(root, 'node_modules/.bin/prettier') | ||
|
||
describe('prettier', () => { | ||
it('prettierConfig', () => { | ||
expect(prettierConfig).toBeDefined() | ||
}) | ||
|
||
it('formats as expected', async () => { | ||
const configPath = resolve(__dirname, '../../main/js/index.js') | ||
|
||
const prettier = resolve( | ||
__dirname, | ||
'../../../../../node_modules/.bin/prettier', | ||
) | ||
const input = resolve(__dirname, '../fixtures/input.ts') | ||
const output = resolve(__dirname, '../fixtures/output.ts') | ||
const temp = resolve(tmpDir, 'index.ts') | ||
|
||
copyFileSync(input, temp) | ||
|
||
execSync(`${prettier} --config ${configPath} --write ${temp}`) | ||
const configPath = path.resolve(pkgRoot, 'src/main/js/index.js') | ||
const input = path.resolve(pkgRoot, 'src/test/fixtures/input.ts') | ||
const output = path.resolve(pkgRoot, 'src/test/fixtures/output.ts') | ||
|
||
expect(readFileSync(temp, 'utf-8')).toBe(readFileSync(output, 'utf-8')) | ||
const result = cp.execSync(`${bin} ${input} --config ${configPath}`).toString() | ||
expect(result).toBe(fs.readFileSync(output, 'utf-8')) | ||
}) | ||
}) |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Check warning
Code scanning / CodeQL
Shell command built from environment values Medium test
Copilot Autofix AI about 1 month ago
To fix the problem, we should avoid constructing the shell command as a single string and instead use the
cp.execFileSync
method, which allows us to pass the command and its arguments separately. This approach prevents the shell from interpreting special characters in the paths.cp.execSync
call withcp.execFileSync
.bin
) and its arguments (input
,--config
,configPath
) as separate parameters tocp.execFileSync
.