Browse Source

Revert "ci: Remove relaxed mode from eslint (#66921)"

This reverts commit 14916aebcfba07fa126ea3f36487e878c9a78e66.

Co-authored-by: ryan953 <187460+ryan953@users.noreply.github.com>
getsentry-bot 1 year ago
parent
commit
f40d0a4bf1
4 changed files with 14 additions and 11 deletions
  1. 1 0
      .eslintignore
  2. 11 6
      .eslintrc.js
  3. 0 3
      .prettierignore
  4. 2 2
      package.json

+ 1 - 0
.eslintignore

@@ -1,6 +1,7 @@
 **/dist/**/*
 **/vendor/**/*
 **/tests/**/fixtures/**/*
+/scripts/*.js
 !.github
 !.github/workflows/scripts/*
 *.d.ts

+ 11 - 6
.eslintrc.js

@@ -1,21 +1,26 @@
 /* eslint-env node */
 
+const isRelaxed = !!process.env.SENTRY_ESLINT_RELAXED;
+
+// Strict ruleset that runs on pre-commit and in local environments
+const ADDITIONAL_HOOKS_TO_CHECK_DEPS_FOR =
+  '(useEffectAfterFirstRender|useMemoWithPrevious)';
+
 module.exports = {
   root: true,
-  extends: ['sentry-app/strict'],
+  extends: [isRelaxed ? 'sentry-app' : 'sentry-app/strict'],
   globals: {
-    expect: false,
-    jest: true,
-    MockApiClient: true,
     require: false,
+    expect: false,
     sinon: false,
+    MockApiClient: true,
     tick: true,
+    jest: true,
   },
-
   rules: {
     'react-hooks/exhaustive-deps': [
       'error',
-      {additionalHooks: '(useEffectAfterFirstRender|useMemoWithPrevious)'},
+      {additionalHooks: ADDITIONAL_HOOKS_TO_CHECK_DEPS_FOR},
     ],
 
     // TODO(@anonrig): Remove this from eslint-sentry-config

+ 0 - 3
.prettierignore

@@ -1,3 +0,0 @@
-**/tests/**/fixtures/**/*
-fixtures/**/*
-tests/relay_integration/**/*

+ 2 - 2
package.json

@@ -227,11 +227,11 @@
     "lint:js": "eslint static/app tests/js --ext .js,.jsx,.ts,.tsx",
     "lint:css": "stylelint 'static/app/**/*.[jt]sx'",
     "lint:biome": "biome check .",
-    "lint:prettier": "prettier \"**/*.md\" \"**/*.yaml\" \"**/*.[jt]s(x)?\" --check",
+    "lint:prettier": "prettier \"**/*.md\" \"**/*.yaml\" \"**/*.{ts,tsx}\" --check",
     "fix": "yarn fix:biome && yarn fix:prettier && yarn fix:eslint",
     "fix:eslint": "eslint static/app tests/js --ext .js,.jsx,.ts,.tsx --fix",
     "fix:biome": "biome check . --apply",
-    "fix:prettier": "prettier \"**/*.md\" \"**/*.yaml\" \"**/*.[jt]s(x)?\" --write",
+    "fix:prettier": "prettier \"**/*.md\" \"**/*.yaml\" \"**/*.{ts,tsx}\" --write",
     "dev": "(yarn check --verify-tree || yarn install --check-files) && sentry devserver",
     "dev-ui": "SENTRY_UI_DEV_ONLY=1 SENTRY_WEBPACK_PROXY_PORT=7999 yarn webpack serve",
     "dev-acceptance": "NO_DEV_SERVER=1 NODE_ENV=development yarn webpack --watch",