diff --git a/.vscode/settings.json b/.vscode/settings.json index 776381213d..e51a6a33ae 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -4,6 +4,7 @@ "files.trimFinalNewlines": true, "files.trimTrailingWhitespace": true, "eslint.workingDirectories": [ + "./clients", "./clients/admin-ui", "./clients/fides-js", "./clients/fidesui", diff --git a/CHANGELOG.md b/CHANGELOG.md index b5dd678670..44ede175ad 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -27,6 +27,9 @@ The types of changes are: - Fixed malformed HTML issue on switch components [#5166](https://github.com/ethyca/fides/pull/5166) - Fixed a timing issue with tcf/gpp locator iframe naming [#5173](https://github.com/ethyca/fides/pull/5173) +### Developer Experience +- Fixes some ESLint configuration issues [#5176](https://github.com/ethyca/fides/pull/5176) + ## [2.42.1](https://github.com/ethyca/fides/compare/2.42.0...2.42.1) ### Fixed diff --git a/clients/.eslintignore b/clients/.eslintignore new file mode 100644 index 0000000000..b62993c3ff --- /dev/null +++ b/clients/.eslintignore @@ -0,0 +1 @@ +**/.eslintrc* diff --git a/clients/.eslintrc.json b/clients/.eslintrc.cjs similarity index 54% rename from clients/.eslintrc.json rename to clients/.eslintrc.cjs index 1acdb2578c..7240b56205 100644 --- a/clients/.eslintrc.json +++ b/clients/.eslintrc.cjs @@ -1,16 +1,16 @@ -{ - "extends": ["airbnb", "airbnb-typescript", "plugin:prettier/recommended"], - "plugins": ["simple-import-sort"], - "root": true, - "rules": { - "curly": ["error", "all"], +module.exports = { + extends: ["airbnb", "airbnb-typescript", "plugin:prettier/recommended"], + plugins: ["simple-import-sort"], + root: true, + rules: { + curly: ["error", "all"], "nonblock-statement-body-position": ["error", "below"], "react/function-component-definition": [ 2, - { "namedComponents": "arrow-function" } + { namedComponents: "arrow-function" }, ], - "react/jsx-filename-extension": ["warn", { "extensions": [".tsx"] }], - "react/jsx-key": ["error", { "checkFragmentShorthand": true }], + "react/jsx-filename-extension": ["warn", { extensions: [".tsx"] }], + "react/jsx-key": ["error", { checkFragmentShorthand: true }], "react/jsx-props-no-spreading": "off", "simple-import-sort/imports": "error", "simple-import-sort/exports": "error", @@ -22,20 +22,21 @@ "no-param-reassign": [ "error", { - "props": true, - "ignorePropertyModificationsForRegex": ["^draft"] - } + props: true, + ignorePropertyModificationsForRegex: ["^draft"], + }, ], "@typescript-eslint/ban-types": [ "error", { - "types": { + types: { "React.FC": { - "message": "Remove entirely and allow Typescript to infer JSX.Element." - } - } - } + message: + "Remove entirely and allow Typescript to infer JSX.Element.", + }, + }, + }, ], - "prettier/prettier": "warn" - } -} + "prettier/prettier": "warn", + }, +}; diff --git a/clients/admin-ui/.eslintignore b/clients/admin-ui/.eslintignore index fbdb7c9382..f2d753109e 100644 --- a/clients/admin-ui/.eslintignore +++ b/clients/admin-ui/.eslintignore @@ -2,7 +2,6 @@ node_modules dist out public/**/*.js -.eslintrc.json next.config.js jest.config.js cypress.config.ts diff --git a/clients/admin-ui/.eslintrc.cjs b/clients/admin-ui/.eslintrc.cjs new file mode 100644 index 0000000000..266f833b40 --- /dev/null +++ b/clients/admin-ui/.eslintrc.cjs @@ -0,0 +1,11 @@ +module.exports = { + extends: ["next/core-web-vitals"], + parserOptions: { + project: "tsconfig.json", + tsconfigRootDir: __dirname, + }, + rules: { + // since we are using static site export + "@next/next/no-img-element": "off", + }, +}; diff --git a/clients/admin-ui/.eslintrc.json b/clients/admin-ui/.eslintrc.json deleted file mode 100644 index ba71718497..0000000000 --- a/clients/admin-ui/.eslintrc.json +++ /dev/null @@ -1,11 +0,0 @@ -{ - "extends": ["next/core-web-vitals"], - "parserOptions": { - "project": "tsconfig.json", - "tsconfigRootDir": "./" - }, - "rules": { - // since we are using static site export - "@next/next/no-img-element": "off" - } -} diff --git a/clients/admin-ui/cypress/.eslintrc.cjs b/clients/admin-ui/cypress/.eslintrc.cjs new file mode 100644 index 0000000000..941c4ff119 --- /dev/null +++ b/clients/admin-ui/cypress/.eslintrc.cjs @@ -0,0 +1,13 @@ +module.exports = { + extends: ["plugin:cypress/recommended"], + plugins: ["no-only-tests", "cypress"], + root: true, + parserOptions: { + project: "./tsconfig.json", + tsconfigRootDir: __dirname, + }, + rules: { + "no-only-tests/no-only-tests": "error", + "cypress/unsafe-to-chain-command": "off", + }, +}; diff --git a/clients/admin-ui/cypress/.eslintrc.json b/clients/admin-ui/cypress/.eslintrc.json deleted file mode 100644 index 203b815f50..0000000000 --- a/clients/admin-ui/cypress/.eslintrc.json +++ /dev/null @@ -1,12 +0,0 @@ -{ - "extends": ["plugin:cypress/recommended"], - "plugins": ["no-only-tests", "cypress"], - "parserOptions": { - "project": "./tsconfig.json", - "tsconfigRootDir": "cypress" - }, - "rules": { - "no-only-tests/no-only-tests": "error", - "cypress/unsafe-to-chain-command": "off" - } -} diff --git a/clients/fides-js/.eslintignore b/clients/fides-js/.eslintignore index d69fe14578..617f489add 100644 --- a/clients/fides-js/.eslintignore +++ b/clients/fides-js/.eslintignore @@ -1,5 +1,4 @@ node_modules dist -.eslintrc.json jest.config.js rollup.config.mjs diff --git a/clients/fides-js/.eslintrc.cjs b/clients/fides-js/.eslintrc.cjs new file mode 100644 index 0000000000..b5edc8c371 --- /dev/null +++ b/clients/fides-js/.eslintrc.cjs @@ -0,0 +1,16 @@ +module.exports = { + extends: ["preact"], + parserOptions: { + project: "tsconfig.json", + tsconfigRootDir: __dirname, + }, + parser: "@typescript-eslint/parser", + rules: { + "import/no-cycle": "off", + "import/extensions": "off", + "react/prop-types": "off", + "no-undef": "off", + "no-unused-vars": "off", // the @typescript-eslint line below is smarter about handling unused variables, taking in to account TS interfaces + "@typescript-eslint/no-unused-vars": ["error", { varsIgnorePattern: "^_" }], + }, +}; diff --git a/clients/fides-js/.eslintrc.json b/clients/fides-js/.eslintrc.json deleted file mode 100644 index a766a4a6d0..0000000000 --- a/clients/fides-js/.eslintrc.json +++ /dev/null @@ -1,19 +0,0 @@ -{ - "extends": ["preact"], - "parserOptions": { - "project": "tsconfig.json", - "tsconfigRootDir": "./" - }, - "parser": "@typescript-eslint/parser", - "rules": { - "import/no-cycle": "off", - "import/extensions": "off", - "react/prop-types": "off", - "no-undef": "off", - "no-unused-vars": "off", // the @typescript-eslint line below is smarter about handling unused variables, taking in to account TS interfaces - "@typescript-eslint/no-unused-vars": [ - "error", - { "varsIgnorePattern": "^_" } - ] - } -} diff --git a/clients/fides-js/src/components/tcf/TcfFeatures.tsx b/clients/fides-js/src/components/tcf/TcfFeatures.tsx index 5252e6c454..40e5962e94 100644 --- a/clients/fides-js/src/components/tcf/TcfFeatures.tsx +++ b/clients/fides-js/src/components/tcf/TcfFeatures.tsx @@ -1,12 +1,11 @@ import { h } from "preact"; -import { UpdateEnabledIds } from "~/components/tcf/TcfTabs"; - import { PrivacyExperience } from "../../lib/consent-types"; import { I18n } from "../../lib/i18n"; import { TCFFeatureRecord, TCFSpecialFeatureRecord } from "../../lib/tcf/types"; import EmbeddedVendorList from "./EmbeddedVendorList"; import RecordsList, { RecordListType } from "./RecordsList"; +import { UpdateEnabledIds } from "./TcfTabs"; const FeatureChildren = ({ i18n, diff --git a/clients/fides-js/src/services/api.ts b/clients/fides-js/src/services/api.ts index 244001a4d7..bffd74eb65 100644 --- a/clients/fides-js/src/services/api.ts +++ b/clients/fides-js/src/services/api.ts @@ -1,5 +1,3 @@ -import { Locale } from "~/fides"; - import { ComponentType, ConsentMethod, @@ -13,6 +11,7 @@ import { RecordsServedResponse, } from "../lib/consent-types"; import { debugLog } from "../lib/consent-utils"; +import { Locale } from "../lib/i18n"; import { GVLTranslations } from "../lib/tcf/types"; export enum FidesEndpointPaths { diff --git a/clients/fidesui/.eslintrc.cjs b/clients/fidesui/.eslintrc.cjs new file mode 100644 index 0000000000..24879f3ac7 --- /dev/null +++ b/clients/fidesui/.eslintrc.cjs @@ -0,0 +1,15 @@ +module.exports = { + env: { + browser: true, + es2021: true, + }, + parser: "@typescript-eslint/parser", + parserOptions: { + project: "tsconfig.json", + tsconfigRootDir: __dirname, + }, + rules: { + "import/no-extraneous-dependencies": "off", + "react/react-in-jsx-scope": "off", + }, +}; diff --git a/clients/fidesui/.eslintrc.json b/clients/fidesui/.eslintrc.json deleted file mode 100644 index 19d5c1e935..0000000000 --- a/clients/fidesui/.eslintrc.json +++ /dev/null @@ -1,15 +0,0 @@ -{ - "env": { - "browser": true, - "es2021": true - }, - "parser": "@typescript-eslint/parser", - "parserOptions": { - "project": "tsconfig.json", - "tsconfigRootDir": "./" - }, - "rules": { - "import/no-extraneous-dependencies": "off", - "react/react-in-jsx-scope": "off" - } -} diff --git a/clients/privacy-center/.eslintignore b/clients/privacy-center/.eslintignore index fbdb7c9382..f2d753109e 100644 --- a/clients/privacy-center/.eslintignore +++ b/clients/privacy-center/.eslintignore @@ -2,7 +2,6 @@ node_modules dist out public/**/*.js -.eslintrc.json next.config.js jest.config.js cypress.config.ts diff --git a/clients/privacy-center/.eslintrc.cjs b/clients/privacy-center/.eslintrc.cjs new file mode 100644 index 0000000000..18312d878f --- /dev/null +++ b/clients/privacy-center/.eslintrc.cjs @@ -0,0 +1,30 @@ +module.exports = { + extends: ["next/core-web-vitals"], + parserOptions: { + project: "tsconfig.json", + tsconfigRootDir: __dirname, + }, + overrides: [ + { + // Require Swagger JSdoc for all /api routes + files: ["pages/api/**/*.ts"], + plugins: ["jsdoc"], + rules: { + "jsdoc/no-missing-syntax": [ + "error", + { + contexts: [ + { + comment: "JsdocBlock:has(JsdocTag[tag=swagger])", + context: "any", + message: + "@swagger documentation is required. See: https://github.com/jellydn/next-swagger-doc", + }, + ], + }, + ], + }, + }, + ], + rules: {}, +}; diff --git a/clients/privacy-center/.eslintrc.json b/clients/privacy-center/.eslintrc.json deleted file mode 100644 index 51a686d503..0000000000 --- a/clients/privacy-center/.eslintrc.json +++ /dev/null @@ -1,29 +0,0 @@ -{ - "extends": ["next/core-web-vitals"], - "overrides": [ - { - // Require Swagger JSdoc for all /api routes - "files": ["pages/api/**/*.ts"], - "plugins": ["jsdoc"], - "rules": { - "jsdoc/no-missing-syntax": [ - "error", - { - "contexts": [ - { - "comment": "JsdocBlock:has(JsdocTag[tag=swagger])", - "context": "any", - "message": "@swagger documentation is required. See: https://github.com/jellydn/next-swagger-doc" - } - ] - } - ] - } - } - ], - "parserOptions": { - "project": "tsconfig.json", - "tsconfigRootDir": "./" - }, - "rules": {} -} diff --git a/clients/privacy-center/cypress/.eslintrc.cjs b/clients/privacy-center/cypress/.eslintrc.cjs new file mode 100644 index 0000000000..941c4ff119 --- /dev/null +++ b/clients/privacy-center/cypress/.eslintrc.cjs @@ -0,0 +1,13 @@ +module.exports = { + extends: ["plugin:cypress/recommended"], + plugins: ["no-only-tests", "cypress"], + root: true, + parserOptions: { + project: "./tsconfig.json", + tsconfigRootDir: __dirname, + }, + rules: { + "no-only-tests/no-only-tests": "error", + "cypress/unsafe-to-chain-command": "off", + }, +}; diff --git a/clients/privacy-center/cypress/.eslintrc.json b/clients/privacy-center/cypress/.eslintrc.json deleted file mode 100644 index 203b815f50..0000000000 --- a/clients/privacy-center/cypress/.eslintrc.json +++ /dev/null @@ -1,12 +0,0 @@ -{ - "extends": ["plugin:cypress/recommended"], - "plugins": ["no-only-tests", "cypress"], - "parserOptions": { - "project": "./tsconfig.json", - "tsconfigRootDir": "cypress" - }, - "rules": { - "no-only-tests/no-only-tests": "error", - "cypress/unsafe-to-chain-command": "off" - } -} diff --git a/clients/sample-app/.eslintrc.js b/clients/sample-app/.eslintrc.cjs similarity index 91% rename from clients/sample-app/.eslintrc.js rename to clients/sample-app/.eslintrc.cjs index 3a233bb05c..14bcf2c15f 100644 --- a/clients/sample-app/.eslintrc.js +++ b/clients/sample-app/.eslintrc.cjs @@ -5,6 +5,14 @@ module.exports = { "prettier", "next/core-web-vitals", ], + parser: "@typescript-eslint/parser", + parserOptions: { + ecmaVersion: 2022, + sourceType: "module", + project: "tsconfig.json", + tsconfigRootDir: __dirname, + createDefaultProgram: true, + }, root: true, rules: { // "curly": ["error", "all"], @@ -20,11 +28,4 @@ module.exports = { ], "react/require-default-props": "off", }, - parserOptions: { - ecmaVersion: 2022, - sourceType: "module", - project: "./tsconfig.json", - tsconfigRootDir: __dirname, - createDefaultProgram: true, - }, };