linter-phpcs
linter-phpcs copied to clipboard
disableWhenNoConfigFile not really working
Something that bothered me when working in projects without a config file, it throws errors every time you click on a file, even when I have check on the "disableWhenNoConfigFile". The problem is that this check is not being executed early enough. By moving this check further up, right under "const parameters = ['--report=json'];" this issue is resolved.
// Check if a config file exists and handle it
const confFileNames = [
'.phpcs.xml', '.phpcs.xml.dist', 'phpcs.xml', 'phpcs.xml.dist',
'phpcs.ruleset.xml', 'ruleset.xml',
];
const confFile = await helpers.findAsync(fileDir, confFileNames);
if (this.disableWhenNoConfigFile && !confFile) {
return [];
}