Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
// https://github.com/eslint/eslint/issues/6237
// ...so we have no choice but to rely on it being hoisted.
plugins: ['standard'],
rules: {
...(babel
? {
// Ensure the replacement rules use the options set by eslint-config-standard rather than ESLint defaults.
'babel/new-cap': standardRules['new-cap'],
// eslint-config-standard doesn't currently have an explicit value for these two rules, so
// they default to off. The fallbacks are not added to the other rules, so changes in the
// preset configuration layout doesn't silently cause rules to be disabled.
'babel/no-invalid-this':
standardRules['no-invalid-this'] || 'off',
'babel/object-curly-spacing':
standardRules['object-curly-spacing'] || 'off',
'babel/semi': standardRules.semi,
'babel/no-unused-expressions':
standardRules['no-unused-expressions']
}
: {})
},
settings: {
react: {
// https://github.com/yannickcr/eslint-plugin-react#configuration
// This is undocumented, but equivalent to "latest version".
version: '999.999.999'
}
}
})
}
},
rules: {
// Disable rules for which there are eslint-plugin-babel replacements:
// https://github.com/babel/eslint-plugin-babel#rules
'new-cap': 'off',
'no-invalid-this': 'off',
'object-curly-spacing': 'off',
semi: 'off',
'no-unused-expressions': 'off',
// Ensure the replacement rules use the options set by eslint-config-standard rather than ESLint defaults.
'babel/new-cap': standardRules['new-cap'],
// eslint-config-standard doesn't currently have an explicit value for no-invalid-this, so
// it defaults to off. The fallback is not added to the other rules, so changes in the
// preset configuration layout doesn't silently cause rules to be disabled.
'babel/no-invalid-this': standardRules['no-invalid-this'] || 'off',
'babel/object-curly-spacing': standardRules['object-curly-spacing'],
'babel/semi': standardRules.semi,
'babel/no-unused-expressions':
standardRules['no-unused-expressions'],
...baseConfig.rules,
},
},
},
}),
);
};
const docs = await Promise.all(
results.map(async ({ uri }) => sourcegraph.workspace.openTextDocument(new URL(uri)))
)
const tseslintConfig: TSESLint.ParserOptions = {
ecmaVersion: 2018,
range: true,
sourceType: 'module',
filePath: 'foo.tsx',
useJSXTextNode: true,
ecmaFeatures: { jsx: true },
}
const linter = new Linter()
linter.defineParser('@typescript-eslint/parser', tseslintParser)
const stdRules = _eslintConfigStandard.rules
for (const ruleId of Object.keys(stdRules)) {
if (!linter.getRules().has(ruleId)) {
delete stdRules[ruleId]
}
}
// delete stdRules.indent
// delete stdRules['space-before-function-paren']
// delete stdRules['no-undef']
// delete stdRules['comma-dangle']
// delete stdRules['no-unused-vars']
const config: Linter.Config = {
parser: '@typescript-eslint/parser',
parserOptions: tseslintConfig,
rules: {
...stdRules,