-
-
Notifications
You must be signed in to change notification settings - Fork 46
Open
Labels
help wantedWe are looking for community helpWe are looking for community helptype: bugFunctionality that does not work as intended/expectedFunctionality that does not work as intended/expected
Description
Request / Idea
This is a feature request to have the ability to disable warnings via code comments or global config rules.
Right now this section of code
Lines 1456 to 1483 in 9e6620a
// Continue without formatting the content | |
const warningContext: string[] = [ | |
'[PugPrinter:start-pipeless-text]:', | |
'The following expression could not be formatted correctly.', | |
'This is likely a syntax error or an issue caused by the missing execution context.', | |
'If you think this is a bug, please open a bug issue.' | |
]; | |
warningContext.push(`\ncode: \`${rawText.trim()}\``); | |
// TODO: If other token types occur use `if (usedInterpolatedCode)` | |
warningContext.push( | |
'\nYou used interpolated code in your pipeless script tag, so you may ignore this warning.' | |
); | |
if (types.isNativeError(error)) { | |
warningContext.push(`\nFound ${parser} ${error.name}: ${error.message}.`); | |
} else { | |
logger.debug('typeof error:', typeof error); | |
warningContext.push(`\nUnexpected error for parser ${parser}.`, error as string); | |
} | |
logger.warn(...warningContext); | |
result = rawText; | |
} | |
Similar to being able to ignore automatic formatting, it would be great to have (via comments or config, or both possibly), the ability to ignore warnings.
e.g. https://prettier.github.io/plugin-pug/guide/#usage highlights the ability to write //- prettier-ignore
before a block of code to disable prettier from auto-formatting it
Input
❯ npx prettier app/views/layout.pug --write --loglevel error
[PugPrinter:start-pipeless-text]: The following expression could not be formatted correctly. This is likely a syntax error or an issue caused by the missing execution context. If you think this is a bug, please open a bug issue.
code: `window._types = {
success: "#{ t('Success') }",
error: "#{ t('Error') }",
info: "#{ t('Info') }",
warning: "#{ t('Warning') }",
question: "#{ t('Question') }"
};
window._messages = !{json(flash(), null, null)};`
You used interpolated code in your pipeless script tag, so you may ignore this warning.
Found babel SyntaxError: Unexpected token, expected "," (8:32)
6 | question: "#{ t('Question') }"
7 | };
> 8 | window._messages = !{json(flash(), null, null)};
| ^
9 |.
Expected Output
None
Additional Context
There is no ability that I've found so far as to disable warnings, or specific warnings related to specific blocks/lines of code.
Metadata
Metadata
Assignees
Labels
help wantedWe are looking for community helpWe are looking for community helptype: bugFunctionality that does not work as intended/expectedFunctionality that does not work as intended/expected