How to use the RuleTester function from eslint
Find comprehensive JavaScript eslint.RuleTester code examples handpicked from public code repositorys.
1 2 3 4 5 6 7 8 9 10
// Browser that doesn't support any features of this version - see es-versions.md process.env.BROWSERSLIST = 'Chrome >= 74'; jest.resetModules(); const ruleTester = new RuleTester({ parserOptions: { ecmaVersion: 2021, }, globals: {
9
43
2
21 22 23 24 25 26 27 28 29 30
constructor(options) { super(options); this._liferay = { parsers: { 'babel-eslint': new RuleTester({ ...options, parser: require.resolve('babel-eslint'), }), 'espree': new RuleTester(options),
62
0
1
+ 5 other calls in file
13 14 15 16 17 18 19 20 21 22
})), })) const filename = '@looker/components/src/index.js' new RuleTester({ parser: require.resolve('jsonc-eslint-parser'), }).run('publish-config', rule, { valid: [ {
28
51
22
220 221 222 223 224 225 226 227 228
Para iniciarmos, vamos criar um arquivo e criar uma instância desse `RuleTester`: ```js // arquivo teste.js const { RuleTester } = require('eslint'); const tester = new RuleTester(); ``` Caso seja necessário, você pode passar configurações extras ao instanciar o `RuleTester` para realizar qualquer configuração extra do ESLint.
1
0
1
+ 3 other calls in file
eslint.RuleTester is the most popular function in eslint (26 examples)