Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
236 changes: 0 additions & 236 deletions .eslintrc.cjs

This file was deleted.

1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,4 @@ node_modules/

dist-worker/
.wrangler/
types/worker.d.ts
11 changes: 2 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,12 +46,12 @@ Our full set of linting can be run at any time with:
npm run lint
```

Included in this repository are an [eslint config file](.eslintrc.cjs) as well as an
Included in this repository are an [eslint config file](eslint.config.js) as well as an
[editorconfig file](.editorconfig) to help with ensuring a consistent style in the codebase for the
API server.

To help enforce this, we use both eslint and echint in our testing. To run eslint at any time, which
checks the code style of any JavaScript, you can use:
checks the code style of any TypeScript, you can use:

```sh
npm run lint:eslint
Expand Down Expand Up @@ -97,13 +97,6 @@ a valid DSN URL from Sentry. The `SENTRY_RELEASE` environment variable can also
specific release of the worker (our GitHub Actions workflows for deployments set this to the current
commit hash).

Alongside the normal error reporting that Sentry provides in the worker, we also fire out custom
error events for certain issues to help with improving data consistency across cdnjs:

<!-- - `Missing SRI entry` is fired if there is no SRI hash for a file -->
- `Bad entry in Algolia data` is fired if an entry in Algolia is falsey, or if its name is falsey
- `Bad entry in packages data` is fired if a package is falsey, or if its `name`/`version` is falsey

## Deployment

As this API server is written as a Cloudflare Worker, you can deploy it using the Wrangler CLI. This
Expand Down
32 changes: 32 additions & 0 deletions eslint.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
// @ts-check

import eslint from '@eslint/js';
import { defineConfig } from 'eslint/config';
import tseslint from 'typescript-eslint';
import jsdoc from 'eslint-plugin-jsdoc';

export default defineConfig(
eslint.configs.recommended,
tseslint.configs.strict,
tseslint.configs.stylistic,
jsdoc.configs['flat/recommended-typescript'],
{
name: 'custom/jsdoc',
rules: {
'jsdoc/require-returns': 'off',
'jsdoc/tag-lines': [ 'error', 'any', { startLines: 1 } ]
},
},
{
name: 'custom/spec',
files: [ '**/spec/**/*.ts', '**/*.spec.ts' ],
rules: {
'@typescript-eslint/no-unused-expressions': 'off',
'@typescript-eslint/no-non-null-assertion': 'off',
}
},
{
name: 'custom/ignores',
ignores: [ 'dist-worker/**', 'types/worker.d.ts' ],
}
);
Loading