@quintaaa/eslint-plugin-starlims
Version:
Eslint plugin to parse and lint starlims form code successfully
93 lines (87 loc) • 2.92 kB
JavaScript
const globals = require('globals');
const processors = require('./src/processors');
const rules = require('./src/rules');
const plugin = {
meta: {
name: 'starlims',
version: '1.3.0',
},
configs: {},
rules: {},
processors: {},
};
Object.assign(plugin.configs, {
recommended: {
plugins: {
starlims: plugin,
},
languageOptions: {
ecmaVersion: 2022,
globals: {
...globals.browser,
bridge: true,
form: true,
lims: true,
Button: true,
CheckBox: true,
ComboBox: true,
DataGrid: true,
DataGridColumn: true,
DataSet: true,
Dialogs: true,
EnableIf: true,
EnabledIf: true,
Ext: true,
Form: true,
Frame: true,
GetResource: true,
Image: true,
Label: true,
Menu: true,
MenuItem: true,
Panel: true,
Shell: true,
Starlims: true,
System: true,
TabControl: true,
TabPage: true,
TextArea: true,
TextBox: true,
TreeNode: true,
TreeView: true,
Utils: true,
VisibleIf: true,
},
},
rules: {
'no-unused-vars': [
'warn',
{
varsIgnorePattern:
'^(btn)|(btnbr)|(chk)|(cklst)|(cbo)|(cb)|(dgd)|(dtp)|(frm)|(fra)|(gp)|(img)|(lbl)|(lin)|(bar)|(lnk)|(lst)|(mvw)|(mc)|(pnl)|(prg)|(rb)|(rpt)|(rtf)|(scr)|(spl)|(tc)|(txt)|(txt)|(trv)|(.*_On)',
argsIgnorePattern: '(eventArgs)|(sender)',
},
],
'no-undef': 'warn',
'prefer-const': 'warn',
'dot-notation': 'warn',
'no-else-return': 'error',
'no-lonely-if': 'warn',
'no-unneeded-ternary': 'warn',
'no-useless-return': 'error',
'no-var': 'error',
'prefer-template': 'warn',
'sort-vars': 'warn',
yoda: ['error', 'never', { exceptRange: true }],
'starlims/no-synchronous-requests': 'warn',
'starlims/check-server-functions': 'warn',
'starlims/check-unconverted-functions': 'error',
'starlims/requests-in-loop': 'error',
'starlims/no-ambiguous-vars': 'warn',
'starlims/remove-debugger': 'error',
},
},
});
Object.assign(plugin.rules, rules);
Object.assign(plugin.processors, processors);
module.exports = plugin;