From 4be173cdc2392d70863037f96fead57a0b465a18 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Ka=C4=8Dmar?= Date: Thu, 3 Oct 2024 11:21:58 +0200 Subject: [PATCH] Include examples on how to use configuration --- README.md | 8 +------- contrib/eslint.config.recommended.js | 8 ++++++++ contrib/eslint.config.required.js | 8 ++++++++ 3 files changed, 17 insertions(+), 7 deletions(-) create mode 100644 contrib/eslint.config.recommended.js create mode 100644 contrib/eslint.config.required.js diff --git a/README.md b/README.md index 6bb3f5b..d48df46 100644 --- a/README.md +++ b/README.md @@ -21,13 +21,7 @@ yarn add microsoft/eslint-plugin-sdl ## Configs -Including an ESLint configuration file in your project allows you to customize how ESLint applies rules to your project. You can include the plugin in your [configuration file](https://eslint.org/docs/latest/use/configure/configuration-files) by adding: - -```js -const pluginMicrosoftSdl = require("@microsoft/eslint-plugin-sdl"); - -module.exports = [...pluginMicrosoftSdl.configs.recommended]; -``` +Including an ESLint configuration file in your project allows you to customize how ESLint applies rules to your project. You can include the plugin in your [configuration file](https://eslint.org/docs/latest/use/configure/configuration-files) as described in examples for [`recommended`](contrib/eslint.config.recommended.js) and [`required`](contrib/eslint.config.required.js) configurations. ESLint will then only enforce rules you specify in the rules section of your configuration file at the [severity level](https://eslint.org/docs/latest/use/configure/rules) you designate. For example: diff --git a/contrib/eslint.config.recommended.js b/contrib/eslint.config.recommended.js new file mode 100644 index 0000000..e5c851d --- /dev/null +++ b/contrib/eslint.config.recommended.js @@ -0,0 +1,8 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +"use strict"; + +const pluginMicrosoftSdl = require("@microsoft/eslint-plugin-sdl"); + +module.exports = [...pluginMicrosoftSdl.configs.recommended]; diff --git a/contrib/eslint.config.required.js b/contrib/eslint.config.required.js new file mode 100644 index 0000000..27c1aee --- /dev/null +++ b/contrib/eslint.config.required.js @@ -0,0 +1,8 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +"use strict"; + +const pluginMicrosoftSdl = require("@microsoft/eslint-plugin-sdl"); + +module.exports = [...pluginMicrosoftSdl.configs.required];