Skip to content

Commit

Permalink
feat: add lockfile-lint tooling and docs
Browse files Browse the repository at this point in the history
  • Loading branch information
pbredenberg committed Aug 31, 2023
1 parent 6d96faa commit f85cbf5
Show file tree
Hide file tree
Showing 5 changed files with 378 additions and 270 deletions.
18 changes: 18 additions & 0 deletions .lockfile-lint.shared.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
'use strict';

module.exports = {

path: 'package-lock.json',
type: 'npm',
// to many packages are still on the previous-gen sha
validateIntegrity: false,
emptyHostname: false,
allowedHosts: [ 'npm', 'github.com' ],
allowedSchemes: [
'https:',
'git+ssh:',
'git+https:',
],
validatePackageNames: true,

};
38 changes: 38 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,44 @@ possible that some processes in some projects could fail when the wrong version
is enabled in the developer's environment. This helps eliminate one factor from the
equation when troubleshooting.

### lockfile-lint

The [`lockfile-lint`](https://github.com/lirantal/lockfile-lint) allows us to enforce
additional security policies regarding NPM package sources, such as allowed package
registries and code sources and package source HTTP protocols.

To configure the tool, add a file named `lockfile-lint.config.js` to your project root,
with the following contents:

```js
'use strict';

const sharedConfig = require('@silvermine/standardization/.lockfile-lint.shared.js');

module.exports = {

...sharedConfig,

// Add any overrides here.
// See the lockfile-lint docs for more information.

};

```

Then add the following NPM script to your `package.json` file. Call the script as part
of the tooling chain in the `standards` NPM script:

```json
{
"scripts": {
"lockfile-lint": "lockfile-lint",
"standards": "npm run lockfile-lint && npm run markdownlint"
}
}

```

### Executing ESLint

When ESLint is needed for a project, add an `eslint` task to package.json, and execute it
Expand Down
9 changes: 9 additions & 0 deletions lockfile-lint.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
'use strict';

const sharedConfig = require('./.lockfile-lint.shared.js');

module.exports = {

...sharedConfig,

};
Loading

0 comments on commit f85cbf5

Please sign in to comment.