Skip to content

Commit 7f04b93

Browse files
authored
chore: Tidy up node & config files including excepting them from import/no-nodejs-modules (#83691)
1 parent c4721eb commit 7f04b93

15 files changed

+20
-28
lines changed

.github/workflows/scripts/deploy.js

-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
/* eslint-env node */
2-
31
/**
42
* GHA Workflow helpers for deploys
53
*

.github/workflows/scripts/getsentry-dispatch.js

-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
/* eslint-env node */
2-
31
/**
42
* List of workflows to dispatch to `getsentry`
53
*

api-docs/index.ts

+3-4
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,26 @@
1-
/* global process */
2-
/* eslint-env node */
3-
/* eslint import/no-unresolved:0 */
41
import yaml from 'js-yaml';
52
import JsonRefs from 'json-refs';
63
import fs from 'node:fs';
74
import path from 'node:path';
85

96
function dictToString(dict) {
10-
const res = [];
7+
const res: string[] = [];
118
for (const [k, v] of Object.entries(dict)) {
129
res.push(`${k}: ${v}`);
1310
}
1411
return res.join('\n');
1512
}
1613

1714
function bundle(originalFile) {
15+
// @ts-expect-error: Types do not match the version of js-yaml installed
1816
const root = yaml.safeLoad(fs.readFileSync(originalFile, 'utf8'));
1917
const options = {
2018
filter: ['relative', 'remote', 'local'],
2119
resolveCirculars: true,
2220
location: originalFile,
2321
loaderOptions: {
2422
processContent: function (res, callback) {
23+
// @ts-expect-error: Types do not match the version of js-yaml installed
2524
callback(undefined, yaml.safeLoad(res.text));
2625
},
2726
},

api-docs/openapi-diff.ts

+1-3
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,3 @@
1-
/* eslint-env node */
2-
/* eslint import/no-unresolved:0 */
3-
41
import yaml from 'js-yaml';
52
import jsonDiff from 'json-diff';
63
import fs from 'node:fs';
@@ -26,6 +23,7 @@ async function main() {
2623
);
2724

2825
const readFile = fs.readFileSync('tests/apidocs/openapi-derefed.json', 'utf8');
26+
// @ts-expect-error: Types do not match the version of js-yaml installed
2927
const target = yaml.safeLoad(readFile);
3028

3129
// eslint-disable-next-line no-console

api-docs/watch.ts

-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
/* eslint-env node */
2-
/* eslint import/no-unresolved:0, no-console:0 */
31
import {spawn} from 'node:child_process';
42
import {join} from 'node:path';
53
import {stderr, stdout} from 'node:process';

babel.config.ts

-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
/* eslint-env node */
2-
31
import type {TransformOptions} from '@babel/core';
42

53
const config: TransformOptions = {

build-utils/last-built-plugin.ts

-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
/* eslint-env node */
2-
31
import fs from 'node:fs';
42
import path from 'node:path';
53
import type webpack from 'webpack';

build-utils/sentry-instrumentation.ts

-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
/* eslint-env node */
21
import type {Span} from '@sentry/core';
32
import type * as Sentry from '@sentry/node';
43
import crypto from 'node:crypto';

config/webpack.chartcuterie.config.ts

-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
/* eslint-env node */
2-
31
import childProcess from 'node:child_process';
42
import path from 'node:path';
53
import webpack from 'webpack';

eslint.config.mjs

+13-2
Original file line numberDiff line numberDiff line change
@@ -307,6 +307,7 @@ export default typescript.config([
307307
'import/no-anonymous-default-export': 'error',
308308
'import/no-duplicates': 'error',
309309
'import/no-named-default': 'error',
310+
'import/no-nodejs-modules': 'error',
310311
'import/no-webpack-loader-syntax': 'error',
311312

312313
// https://github.com/import-js/eslint-plugin-import/blob/main/config/recommended.js
@@ -597,13 +598,17 @@ export default typescript.config([
597598
},
598599
{
599600
name: 'files/*.config.*',
600-
files: ['*.config.*'],
601+
files: ['**/*.config.*'],
601602
languageOptions: {
602603
globals: {
603604
...globals.commonjs,
604605
...globals.node,
605606
},
606607
},
608+
609+
rules: {
610+
'import/no-nodejs-modules': 'off',
611+
},
607612
},
608613
{
609614
name: 'files/scripts',
@@ -617,6 +622,8 @@ export default typescript.config([
617622
},
618623
rules: {
619624
'no-console': 'off',
625+
626+
'import/no-nodejs-modules': 'off',
620627
},
621628
},
622629
{
@@ -625,15 +632,19 @@ export default typescript.config([
625632
'tests/js/jest-pegjs-transform.js',
626633
'tests/js/sentry-test/echartsMock.js',
627634
'tests/js/sentry-test/importStyleMock.js',
635+
'tests/js/sentry-test/loadFixtures.ts',
628636
'tests/js/sentry-test/svgMock.js',
637+
'tests/js/setup.ts',
629638
],
630639
languageOptions: {
631640
sourceType: 'commonjs',
632641
globals: {
633642
...globals.commonjs,
634643
},
635644
},
636-
rules: {},
645+
rules: {
646+
'import/no-nodejs-modules': 'off',
647+
},
637648
},
638649
{
639650
name: 'files/devtoolbar',

jest.config.ts

-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
/* eslint-env node */
21
import type {Config} from '@jest/types';
32
import path from 'node:path';
43
import process from 'node:process';

stylelint.config.js

-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
/* eslint-env node */
21
module.exports = {
32
customSyntax: 'postcss-styled-syntax',
43
extends: ['stylelint-config-recommended'],

tests/js/sentry-test/loadFixtures.ts

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
/* global __dirname */
1+
'use strict';
2+
23
import fs from 'node:fs';
34
import path from 'node:path';
45

tests/js/setup.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1+
'use strict';
12
import '@testing-library/jest-dom';
23

3-
/* eslint-env node */
44
import type {ReactElement} from 'react';
55
import {configure as configureRtl} from '@testing-library/react'; // eslint-disable-line no-restricted-imports
66
import {enableFetchMocks} from 'jest-fetch-mock';

webpack.config.ts

-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
/* eslint-env node */
2-
31
import {WebpackReactSourcemapsPlugin} from '@acemarke/react-prod-sourcemaps';
42
import {RsdoctorWebpackPlugin} from '@rsdoctor/webpack-plugin';
53
import {sentryWebpackPlugin} from '@sentry/webpack-plugin';

0 commit comments

Comments
 (0)