mirror of
https://github.com/n8n-io/n8n.git
synced 2024-12-25 20:54:07 -08:00
24 lines
447 B
JavaScript
24 lines
447 B
JavaScript
|
'use strict';
|
||
|
|
||
|
const rules = require('./local-rules'),
|
||
|
RuleTester = require('eslint').RuleTester;
|
||
|
|
||
|
const ruleTester = new RuleTester();
|
||
|
|
||
|
ruleTester.run('no-uncaught-json-parse', rules['no-uncaught-json-parse'], {
|
||
|
valid: [
|
||
|
{
|
||
|
code: 'try { JSON.parse(foo) } catch (e) {}',
|
||
|
},
|
||
|
{
|
||
|
code: 'JSON.parse(JSON.stringify(foo))',
|
||
|
},
|
||
|
],
|
||
|
invalid: [
|
||
|
{
|
||
|
code: 'JSON.parse(foo)',
|
||
|
errors: [{ messageId: 'noUncaughtJsonParse' }],
|
||
|
},
|
||
|
],
|
||
|
});
|