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 25, 2023
1 parent 8221165 commit 5b6d769
Show file tree
Hide file tree
Showing 6 changed files with 80 additions and 75 deletions.
11 changes: 8 additions & 3 deletions .lockfile-lint.shared.js
Original file line number Diff line number Diff line change
@@ -1,13 +1,18 @@
'use strict';

module.exports = {

path: 'package-lock.json',
type: 'npm',
validateHttps: true,
validateIntegrity: true,
allowedHosts: [ '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,

};
15 changes: 0 additions & 15 deletions lockfilelint.config.js

This file was deleted.

74 changes: 21 additions & 53 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 5b6d769

Please sign in to comment.