Browse Source

chore: Tidy up node & config files including excepting them from import/no-nodejs-modules (#83691)

Ryan Albrecht 1 month ago
parent
commit
7f04b93de5

+ 0 - 2
.github/workflows/scripts/deploy.js

@@ -1,5 +1,3 @@
-/* eslint-env node */
-
 /**
  * GHA Workflow helpers for deploys
  *

+ 0 - 2
.github/workflows/scripts/getsentry-dispatch.js

@@ -1,5 +1,3 @@
-/* eslint-env node */
-
 /**
  * List of workflows to dispatch to `getsentry`
  *

+ 3 - 4
api-docs/index.ts

@@ -1,13 +1,10 @@
-/* global process */
-/* eslint-env node */
-/* eslint import/no-unresolved:0 */
 import yaml from 'js-yaml';
 import JsonRefs from 'json-refs';
 import fs from 'node:fs';
 import path from 'node:path';
 
 function dictToString(dict) {
-  const res = [];
+  const res: string[] = [];
   for (const [k, v] of Object.entries(dict)) {
     res.push(`${k}: ${v}`);
   }
@@ -15,6 +12,7 @@ function dictToString(dict) {
 }
 
 function bundle(originalFile) {
+  // @ts-expect-error: Types do not match the version of js-yaml installed
   const root = yaml.safeLoad(fs.readFileSync(originalFile, 'utf8'));
   const options = {
     filter: ['relative', 'remote', 'local'],
@@ -22,6 +20,7 @@ function bundle(originalFile) {
     location: originalFile,
     loaderOptions: {
       processContent: function (res, callback) {
+        // @ts-expect-error: Types do not match the version of js-yaml installed
         callback(undefined, yaml.safeLoad(res.text));
       },
     },

+ 1 - 3
api-docs/openapi-diff.ts

@@ -1,6 +1,3 @@
-/* eslint-env node */
-/* eslint import/no-unresolved:0 */
-
 import yaml from 'js-yaml';
 import jsonDiff from 'json-diff';
 import fs from 'node:fs';
@@ -26,6 +23,7 @@ async function main() {
   );
 
   const readFile = fs.readFileSync('tests/apidocs/openapi-derefed.json', 'utf8');
+  // @ts-expect-error: Types do not match the version of js-yaml installed
   const target = yaml.safeLoad(readFile);
 
   // eslint-disable-next-line no-console

+ 0 - 2
api-docs/watch.ts

@@ -1,5 +1,3 @@
-/* eslint-env node */
-/* eslint import/no-unresolved:0, no-console:0 */
 import {spawn} from 'node:child_process';
 import {join} from 'node:path';
 import {stderr, stdout} from 'node:process';

+ 0 - 2
babel.config.ts

@@ -1,5 +1,3 @@
-/* eslint-env node */
-
 import type {TransformOptions} from '@babel/core';
 
 const config: TransformOptions = {

+ 0 - 2
build-utils/last-built-plugin.ts

@@ -1,5 +1,3 @@
-/* eslint-env node */
-
 import fs from 'node:fs';
 import path from 'node:path';
 import type webpack from 'webpack';

+ 0 - 1
build-utils/sentry-instrumentation.ts

@@ -1,4 +1,3 @@
-/* eslint-env node */
 import type {Span} from '@sentry/core';
 import type * as Sentry from '@sentry/node';
 import crypto from 'node:crypto';

+ 0 - 2
config/webpack.chartcuterie.config.ts

@@ -1,5 +1,3 @@
-/* eslint-env node */
-
 import childProcess from 'node:child_process';
 import path from 'node:path';
 import webpack from 'webpack';

+ 13 - 2
eslint.config.mjs

@@ -307,6 +307,7 @@ export default typescript.config([
       'import/no-anonymous-default-export': 'error',
       'import/no-duplicates': 'error',
       'import/no-named-default': 'error',
+      'import/no-nodejs-modules': 'error',
       'import/no-webpack-loader-syntax': 'error',
 
       // https://github.com/import-js/eslint-plugin-import/blob/main/config/recommended.js
@@ -597,13 +598,17 @@ export default typescript.config([
   },
   {
     name: 'files/*.config.*',
-    files: ['*.config.*'],
+    files: ['**/*.config.*'],
     languageOptions: {
       globals: {
         ...globals.commonjs,
         ...globals.node,
       },
     },
+
+    rules: {
+      'import/no-nodejs-modules': 'off',
+    },
   },
   {
     name: 'files/scripts',
@@ -617,6 +622,8 @@ export default typescript.config([
     },
     rules: {
       'no-console': 'off',
+
+      'import/no-nodejs-modules': 'off',
     },
   },
   {
@@ -625,7 +632,9 @@ export default typescript.config([
       'tests/js/jest-pegjs-transform.js',
       'tests/js/sentry-test/echartsMock.js',
       'tests/js/sentry-test/importStyleMock.js',
+      'tests/js/sentry-test/loadFixtures.ts',
       'tests/js/sentry-test/svgMock.js',
+      'tests/js/setup.ts',
     ],
     languageOptions: {
       sourceType: 'commonjs',
@@ -633,7 +642,9 @@ export default typescript.config([
         ...globals.commonjs,
       },
     },
-    rules: {},
+    rules: {
+      'import/no-nodejs-modules': 'off',
+    },
   },
   {
     name: 'files/devtoolbar',

Some files were not shown because too many files changed in this diff