Skip to content

Commit

Permalink
chore: linting fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
2wce committed Jul 31, 2024
1 parent 536366c commit d5f9be7
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 9 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/auto-merge.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ jobs:
id: metadata
uses: dependabot/fetch-metadata@v2
with:
github-token: "${{ secrets.GITHUB_TOKEN }}"
github-token: '${{ secrets.GITHUB_TOKEN }}'
- name: Approve a PR
run: gh pr review --approve "$PR_URL"
env:
Expand Down
15 changes: 7 additions & 8 deletions src/index.ts
Original file line number Diff line number Diff line change
@@ -1,17 +1,16 @@
import pluginUtils from '@rollup/pluginutils';
import fs from 'fs';
import { ExistingRawSourceMap, Plugin } from 'rollup';
import { ExistingRawSourceMap, Plugin, PluginContext } from 'rollup';
import { promisify } from 'util';
import { resolveSourceMap, resolveSources } from './source-map-resolve';
import { SourcemapsPluginOptions } from './types';

const { createFilter } = pluginUtils;

export default function sourcemaps({
include,
exclude,
readFile = fs.readFile,
}: SourcemapsPluginOptions = {}): Plugin {
export default function sourcemaps(
// eslint-disable-next-line @typescript-eslint/unbound-method
{ include, exclude, readFile = fs.readFile }: SourcemapsPluginOptions = {},
): Plugin {
// Create a filter function based on the include and exclude options
const filter = createFilter(include, exclude);

Expand All @@ -21,7 +20,7 @@ export default function sourcemaps({
return {
name: 'sourcemaps',

async load(id: string) {
load: async function (this: PluginContext, id: string) {
let code: string;
// If the id does not pass the filter, return null
if (!filter(id)) {
Expand Down Expand Up @@ -66,7 +65,7 @@ export default function sourcemaps({
const { sourcesContent } = await resolveSources(map, id, promisifiedReadFile);
// If all sources are strings, assign them to map.sourcesContent
if (sourcesContent.every(item => typeof item === 'string')) {
map.sourcesContent = sourcesContent as string[];
map.sourcesContent = sourcesContent;
}
} catch {
// If resolving the sources fails, warn
Expand Down

0 comments on commit d5f9be7

Please sign in to comment.