@quintaaa/eslint-plugin-starlims
v1.3.1
Published
Eslint plugin to parse and lint starlims form code successfully
Readme
Starlims ESLint Plugin
This plugin provides custom rules for Starlims.
How to use
Installation
- Create a new project with
npm initin the root folder of your Starlims project - Install ESLint and the plugin with npm:
npm install eslint @quintaaa/eslint-plugin-starlims --save-dev - Create a new file named
eslint.config.jsin the root folder of your Starlims project - Add the following content to the file:
const starlims = require('@quintaaa/eslint-plugin-starlims');
module.exports = [
starlims.configs.recommended,
{
rules: {
// Here is an example of the rules I use
'prefer-const': 'warn',
'no-var': 'warn',
'no-else-return': 'warn',
'no-mixed-spaces-and-tabs': 'off',
// Add your own rules here
// ...
// To edit the plugin default rules, use the following syntax
// The list of rules can be found in in the readme file of the plugin
'starlims/no-synchronous-requests': 'warn',
},
},
];You can customize your ESLint configuration as you wish. For more information, please refer to the ESLint documentation.
You should now be able to use the plugin in your Starlims project.
Usage
Use the following command to lint your Starlims project:
npx eslint .You can also install the ESLint extension for Visual Studio Code to get real-time linting. ESLint extension for Visual Studio Code
List of customizations
- Do not create parsing errors for
#includestatements - Do not report undefined variables for client script functions starting with
cs(e.g.csLoadCrossTab) - Do not report defined but unused variables for event handlers functions (e.g.
Form1_OnLoad,Form1_OnClose,dataGrid1_OnRowChange,btnOk_OnClick) - Allow usage of common Starlims global variables such as:
- form
- lims
- Shell
- Starlims
- Dialogs
- and more...
- Rules
- starlims/no-synchronous-requests --> Reports the usage of functions that are UI blocking and should be avoided (e.g.
lims.CallServer,lims.GetDataSet) - starlims/check-server-functions --> Checks the syntax of server functions such as
lims.CallServerandlims.GetDataSetetc. Also check the syntax of#includestatements - starlims/check-unconverted-functions --> Reports the usage of XFD functions that haven't been converted to html (e.g.
lims.AAdd,Convert.ToInt32) - starlims/requests-in-loop --> Reports the usage of requests in loops (e.g.
for,while,do...while,foreachetc.) - starlims/no-ambiguous-vars --> Reports the usage of ambiguous variables (e.g.
navigatorinstead ofStarlims.navigatororwindow.navigator) - starlims/remove-debugger --> Reports the usage of debugger statements and removes them on autofix
- starlims/no-synchronous-requests --> Reports the usage of functions that are UI blocking and should be avoided (e.g.
Contributing
Any contributions are welcome. Please follow the steps below to contribute:
- Fork the repository
- Create a new branch
- Make your changes
- Create a pull request
If you have any questions or suggestions, please contact me at [email protected] or create an issue.
