chore: fix some bug
chore: update lock
This commit is contained in:
1193
common/autoinstallers/rush-commands/pnpm-lock.yaml
generated
1193
common/autoinstallers/rush-commands/pnpm-lock.yaml
generated
File diff suppressed because it is too large
Load Diff
@ -8,7 +8,7 @@ import { exists } from '../utils/file';
|
||||
*/
|
||||
export const WHITESPACE_RULE: Rule = {
|
||||
name: 'whitespace-only',
|
||||
description: 'Detects files that have only whitespace changes (spaces, tabs, newlines)',
|
||||
description: 'Detects files that have only whitespace changes (spaces, tabs, newlines, blank lines)',
|
||||
filePatterns: FILE_PATTERNS.ALL_FILES
|
||||
} as const;
|
||||
|
||||
@ -55,7 +55,7 @@ export const analyzeWhitespaceRule = async (filePath: string, config: Config): P
|
||||
return createResult(
|
||||
filePath,
|
||||
true,
|
||||
'File has only whitespace changes (spaces, tabs, newlines)'
|
||||
'File has only whitespace changes (spaces, tabs, newlines, blank lines)'
|
||||
);
|
||||
} else {
|
||||
return createResult(
|
||||
|
||||
@ -118,7 +118,7 @@ export const isNewFile = (filePath: string, options: GitOptions): boolean => {
|
||||
};
|
||||
|
||||
/**
|
||||
* Check if a file has only whitespace changes
|
||||
* Check if a file has only whitespace changes (including blank lines)
|
||||
*/
|
||||
export const hasOnlyWhitespaceChanges = (filePath: string, options: GitOptions): boolean => {
|
||||
try {
|
||||
@ -132,7 +132,10 @@ export const hasOnlyWhitespaceChanges = (filePath: string, options: GitOptions):
|
||||
? filePath.substring(projectRoot.length + 1)
|
||||
: filePath;
|
||||
|
||||
const output = execSync(`git diff -w ${options.ref || 'HEAD'} -- "${relativePath}"`, {
|
||||
// Use -w to ignore whitespace changes and -b to ignore blank line changes
|
||||
// --ignore-space-at-eol ignores changes in whitespace at EOL
|
||||
// --ignore-blank-lines ignores changes whose lines are all blank
|
||||
const output = execSync(`git diff -w -b --ignore-space-at-eol --ignore-blank-lines ${options.ref || 'HEAD'} -- "${relativePath}"`, {
|
||||
cwd: options.cwd,
|
||||
encoding: 'utf8',
|
||||
stdio: ['pipe', 'pipe', 'ignore']
|
||||
|
||||
Reference in New Issue
Block a user