From 2e88241887df46a122f9cc4a39d834d032d4eaa9 Mon Sep 17 00:00:00 2001 From: Nico Rehwaldt Date: Thu, 10 Oct 2024 11:07:33 +0200 Subject: [PATCH] docs(README): document modern way of working --- README.md | 51 +++++++++++++++++++++++++++++++++------------------ 1 file changed, 33 insertions(+), 18 deletions(-) diff --git a/README.md b/README.md index a180f22..bd57212 100644 --- a/README.md +++ b/README.md @@ -7,32 +7,47 @@ Common lint rules for [bpmn.io](https://bpmn.io) projects. ## Use -Extend `bpmn-io/*` in your base eslint configuration: +Extend one or more of our recommended configurations: -```json -{ - "extends": "plugin:bpmn-io/browser" -} -``` +```javascript +import bpmnIoPlugin from 'eslint-plugin-bpmn-io'; -If you use [mocha](https://mochajs.org/) for testing, place another `.eslintrc` into your `test` folder and extend from `bpmn-io/mocha`: +export default [ + ...bpmnIoPlugin.configs.recommended +] +``` -```json -{ - "extends": "plugin:bpmn-io/mocha" -} +If you use [mocha](https://mochajs.org/) for testing, add the mocha profile to your specs: + +```javascript +import bpmnIoPlugin from 'eslint-plugin-bpmn-io'; + +export default [ + ...bpmnIoPlugin.configs.browser, + ...bpmnIoPlugin.configs.mocha.map(config => { + return { + ...config, + files: [ + '**/*.spec.js' + ] + }; + }) +] ``` -## Available Recommended Configurations +## Available Configurations + +Base configurations: + +* `browser`: Use for browser based projects +* `node`: Use for node based projects +* `recommended`: Use for libraries where no environment is assumed -We ship with a few blue prints: +Special purpose configurations: -* `bpmn-io/browser`: Use for browser based projects -* `bpmn-io/jsx`: Use `jsx` in conjunction with `browser` -* `bpmn-io/node`: Use for node based projects -* `bpmn-io/mocha`: Use for libraries tested with `mocha` + `chai` -* `bpmn-io/recommended`: Use for libraries where no environment is assumed +* `jsx`: Use `jsx` in conjunction with `browser` +* `mocha`: Use for libraries tested with `mocha` + `chai` ## License