Skip to content

Commit

Permalink
Merge branch 'microsoft:main' into main
Browse files Browse the repository at this point in the history
  • Loading branch information
L-Qun authored Jul 5, 2024
2 parents 1bdd2ee + 5b3a367 commit 0da8375
Show file tree
Hide file tree
Showing 6 changed files with 166 additions and 5 deletions.
15 changes: 15 additions & 0 deletions websites/lfx.rushstack.io/docs/pages/cli/lflint-check.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
---
title: lockfile-lint check
---

> You can use `lflint` as a shorthand for the `lockfile-lint` shell command. In CI scripts, it is recommended to include the full name for readability.
```
usage: lockfile-lint check [-h]
This command applies the policies that are configured in lockfile-lint.json,
reporting any problems found in your PNPM workspace.
Optional arguments:
-h, --help Show this help message and exit.
```
15 changes: 15 additions & 0 deletions websites/lfx.rushstack.io/docs/pages/cli/lflint-init.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
---
title: lockfile-lint init
---

> You can use `lflint` as a shorthand for the `lockfile-lint` shell command. In CI scripts, it is recommended to include the full name for readability.
```
usage: lockfile-lint init [-h]
This command initializes a new lockfile-lint.json config file. The created
template file includes source code comments that document the settings.
Optional arguments:
-h, --help Show this help message and exit.
```
20 changes: 20 additions & 0 deletions websites/lfx.rushstack.io/docs/pages/cli/lfx.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
---
title: lockfile-explorer
---

> You can use `lfx` as a shorthand for the `lockfile-explorer` shell command. In CI scripts, it is recommended to include the full name for readability.
```
usage: lockfile-explorer [-h] [-d] [--subspace SUBSPACE_NAME]
Lockfile Explorer is a desktop app for investigating and solving version
conflicts in a PNPM workspace.
Optional arguments:
-h, --help Show this help message and exit.
-d, --debug Show the full call stack if an error occurs while
executing the tool
--subspace SUBSPACE_NAME
Specifies an individual Rush subspace to check. The
default value is "default".
```
99 changes: 99 additions & 0 deletions websites/lfx.rushstack.io/docs/pages/lint/lockfile-lint.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,99 @@
---
title: Introduction
---

**Lockfile Lint** is a companion tool for preventing problems from reoccurring, after you've solved them using Lockfile Explorer. Similar to ESLint, it provides a config file **lockfile-lint.json** where you can define rules that check for various issues in your lockfile.

## Quick start

1. Lockfile Lint is included in the same package as Lockfile Explorer. If you didn't do so already, install it like this:

```shell
npm install --global @rushstack/lockfile-explorer
```

2. Create the **lockfile-lint.json** config file:

```shell
cd my-rush-repo

lockfile-lint init
```

3. Edit the config file to enable policies that you want to check.

4. Test the policies:

```shell
lockfile-lint check
```

If issues are found, the output might look like this:

```
Rush Lockfile Lint - https://lfx.rushstack.io/
Checking project "my-toolchain"
Checking project "my-app"
Checking project "my-controls"
PROBLEM: [restrict-versions] The version of "whatwg-fetch" should match "2.x"; actual version is "3.6.2"
PROBLEM: [restrict-versions] The version of "colors" should match "2.x"; actual version is "1.4.0"
```

5. Add `lockfile-lint` to your CI validation pipeline. When the tool reports problems, the process exit code will be nonzero, causing the build to fail.

## Config file

**common/config/lockfile-lint/lockfile-lint.json**

```js
/**
* Config file for Lockfile Lint. For more info, please visit: https://lfx.rushstack.io
*/
{
"$schema": "https://developer.microsoft.com/json-schemas/lockfile-explorer/lockfile-lint.schema.json",

/**
* The list of rules to be checked by Lockfile Lint. For each rule configuration, the
* type of rule is determined by the `rule` field.
*/
"rules": [
// /**
// * The `restrict-versions` rule enforces that direct and indirect dependencies must
// * satisfy a specified version range.
// */
// {
// "rule": "restrict-versions",
//
// /**
// * The name of a workspace project to analyze.
// */
// "project": "@my-company/my-app",
//
// /**
// * Indicates the package versions to be checked. The `requiredVersions` key is
// * the name of an NPM package, and the value is a SemVer range. If the project has
// * that NPM package as a dependency, then its version must satisfy the SemVer range.
// * This check also applies to devDependencies and peerDependencies, as well as any
// * indirect dependencies of the project.
// */
// "requiredVersions": {
// /**
// * For example, if `react-router` appears anywhere in the dependency graph of
// * `@my-company/my-app`, then it must be version 5 or 6.
// */
// "react-router": "5.x || 6.x",
// "react": "^18.3.0",
// "react-dom": "^18.3.0"
// }
// }
]
}
```

## See also

- [lockfile-lint init](../cli/lflint-init.md) command
- [lockfile-lint check](../cli/lflint-check.md) command
12 changes: 12 additions & 0 deletions websites/lfx.rushstack.io/sidebars.js
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,18 @@ const sidebars = {
// 'pages/scenarios/phantom_dependencies'
]
},
{
type: 'category',
label: 'Lockfile Lint (EXPERIMENTAL)',
collapsible: false,
items: ['pages/lint/lockfile-lint']
},
{
type: 'category',
label: 'Command line',
collapsible: false,
items: ['pages/cli/lfx', 'pages/cli/lflint-init', 'pages/cli/lflint-check']
},
{
type: 'category',
label: 'Support',
Expand Down
10 changes: 5 additions & 5 deletions websites/rushstack.io/data/people.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,11 @@
"githubAlias": "apostolisms",
"caption": "manages the team that hosts the Rush Stack projects"
},
{
"name": "Cheng",
"githubAlias": "chengcyber",
"caption": "contributed many Rush features including cobuilds and the plugin system"
},
{
"name": "Daniel Nadeau",
"githubAlias": "D4N14L",
Expand Down Expand Up @@ -34,11 +39,6 @@
],
"//": "Alphabetical by first name",
"collaborators": [
{
"name": "Cheng",
"githubAlias": "chengcyber",
"caption": "facilitating: Rush; contributed many features including the Rush plugin system"
},
{
"name": "Elliot Nelson",
"githubAlias": "elliot-nelson",
Expand Down

0 comments on commit 0da8375

Please sign in to comment.