Skip to content

Commit

Permalink
Merge branch 'main' into main
Browse files Browse the repository at this point in the history
  • Loading branch information
mozfreddyb committed Jun 12, 2023
2 parents 17b22cd + b2b76f5 commit b4a5be3
Show file tree
Hide file tree
Showing 3 changed files with 44 additions and 2 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/node-version-integration.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ name: Node CI
on:
push:
branches: [main]
pull_request_target:
pull_request:
branches: [main, release/vNext]

jobs:
Expand Down
37 changes: 37 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,44 @@

Plugin is intended as a baseline for projects that follow [Microsoft Security Development Lifecycle (SDL)](https://www.microsoft.com/en-us/securityengineering/sdl) and use ESLint to perform [Static Analysis Security Testing (SAST)](https://www.microsoft.com/en-us/securityengineering/sdl/practices#practice9).

## Installation

```sh
npm install microsoft/eslint-plugin-sdl
```
or
```sh
yarn add microsoft/eslint-plugin-sdl
```

## Usage
When you run npm install within your project's root folder, the plugin will be added automatically to your package.json and package-lock.json files. You can also add the plugin to your package.json file manually by specifying the name and version number in the dependencies section like so:

```sh
"dependencies": {
"@microsoft/eslint-plugin-sdl": "^0.1.9"
}
```

Run npm install within your root folder to install everything listed in the dependencies section of package.json. If the plugin is listed in your package.json dependencies, eslint will enforce all plugin rules using default settings.

## Configs
Including an eslint configuration file in your project allows you to customize how eslint applies rules to your project. If you are using an .eslintrc file, you can include the plugin by adding:

```sh
plugins: ["@microsoft/eslint-plugin-sdl"]
```

Eslint will then only enforce rules you specify in the rules section of your .eslintrc file at the severity level you designate. The severity level options are 0 (no error), 1 (warning), and 2 (error). For example:

```sh
rules: {
"no-eval": 2,
"@microsoft/sdl/no-inner-html": 2
}
```

You can also used the below Shareable config files as guidelines depending on the type of project.

Plugin is shipped with following [Shareable Configs](http://eslint.org/docs/developer-guide/shareable-configs):

Expand Down
7 changes: 6 additions & 1 deletion config/react.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,11 @@
"use strict";

module.exports = {
parserOptions: {
ecmaFeatures: {
jsx: true,
},
},
plugins: [
"react",
"@microsoft/sdl"
Expand All @@ -23,4 +28,4 @@ module.exports = {
}
]
}
}
}

0 comments on commit b4a5be3

Please sign in to comment.