Commit graph

25 commits

Author SHA1 Message Date
regexowl
692ba3de0d ESLint: Disable autofix for "no-unnecessary-condition"
This disables autofix specifically for the "no-unnecessary-condition" rule. This allows us to continue using autofix without applying the breaking changes.
2025-01-22 14:10:58 +01:00
regexowl
7986828f6c ESLint: Set "no-unnecessary-condition" rule to warn
This adds "no-unnecessary-condition" and sets the output to warn. This should help us eliminate superfluous conditional chaining and uncover potentially faulty conditions.

Docs: https://typescript-eslint.io/rules/no-unnecessary-condition/
2025-01-17 11:57:18 -06:00
regexowl
5b56f09e27 ESLint: Merge .js and .ts configs to one file
Since our code base is now mostly TypeScript, we can merge the configs and have a unified one.

`@typescript-eslint/no-var-requires` was temporarily disabled in webpack configs. These files will be replaced by fec.config.ts in the foreseeable future together with their ESLint override.
2024-06-19 13:13:29 +02:00
Andrew Dewar
3231b324f0 HMS-3796: Add snapshot date selection to wizard 2024-04-25 14:45:50 +02:00
regexowl
3d9f171611 ESLint: Add recommended ruleset for react-redux
This adds a recommended ruleset for react-redux to the ESLint config and adds needed dependency to devDependencies.
2024-04-02 20:21:34 +02:00
regexowl
9cae908341 ESLint: Remove temporary rule overrides
Some rule overrides were previously added when the ruleset got updated as more time to update the code was needed.

This removes some of the temporary rules.
2024-01-05 12:25:10 +01:00
regexowl
cf3b8acc6a ESLint: Temporarily disable non actionable rules
This temporarily disables jsx-a11y/no-autofocus rule. A comment marking the disabled rule was added and another disabled rule was moved under it as well.
2024-01-04 11:30:38 +01:00
regexowl
f0c078921b eslint: Add accessibility rules
This adds eslint-plugin-jsx-a11y to the eslint configuration, setting up recommended set of rules for accessibility testing.

The error output by `jsx-a11y/no-autofocus` on encountering `autoFocus` attribute was switched to warning for now as whether to auto focus on an element or not can be highly contextual.

Fixes #948
2023-11-10 15:05:12 +01:00
regexowl
2687312f16 ESLint: Update rules after removing eslint-config-react-app
This updates rules for linting both JS and TS files in a way that is consistent with previous linting.

Some rules for linting TS files were turned off or switched to warnings for now.
2023-11-08 14:15:17 +01:00
lucasgarfield
c73824cd22 eslint: Disabled rulesdir/forbid-pf-relative-imports
Commit #3e84abba3f bumped
@redhat-cloud-services/eslint-config-redhat-cloud-services from 1.3.0 to
2.0.3.

This introduced a new rule that broke a number of our imports. This
commit forbids the rule for now.

(rulesdir/forbid-pf-relative-imports: off)
2023-10-11 18:03:58 +02:00
Thomas Lavocat
bf7f22413b eslintrc: identation
Correct indentation for the yml content.
2023-08-17 17:18:55 +02:00
Thomas Lavocat
a91ca3f9d0 eslint: configure eslint for react app
Add additional linting information and help on react components and
hooks. See https://www.npmjs.com/package/eslint-config-react-app
https://react.dev/learn/editor-setup#linting

Also, cleans duplicated between eslintrc and eslintrc-typescript.
2023-08-17 17:18:55 +02:00
lucasgarfield
13b02eca7e eslint: Add support for Typescript
This commit adds eslint support for .ts and .tsx files.

The recommended Typescript rules are applied only to .ts and .tsx files
and not to existing .js or .jsx files. This is accomplished by creating
a separate .eslintrc-typescript.yml file and pointing to it in the
.eslintrc.yml overrides parameter.

A .eslintignore file was added. This file has syntax similiar to
.gitignore and is used to ignore the programatically generated API
slices so that we do not have to deal with a massive diff whenever we
update one of them.
2023-08-02 13:46:08 +02:00
lucasgarfield
8f454e5a89 ESLint: Add eqeqeq rule
This rule forbids use of == or !=, and enforces use of === and !==.
2023-06-20 14:55:10 +02:00
regexowl
0363ad7611 ESLint: Add no-console rule
This adds `no-console` rule to throw an error when using any of the `console` methods as those are used only for debugging purposes.
2023-03-27 11:51:56 +02:00
lucasgarfield
4000b8d5e5 ESLint: Add prefer-const rule
Require const declarations for variables that are never reassigned after
being declared. If a variable is never reassigned, using the const
declaration is better. const declaration tells readers, “this variable
is never reassigned,” reducing cognitive load and improving
maintainability.
2023-02-10 11:37:06 +01:00
regexowl
b55d5242a9 ESLint: Refine rules for import order
The import ordering was handled by using `sort-imports` rule for alphabetical ordering and `import` plugin for separating the imports into groups by a type of the import.

The alphabetical sorting was not working very well when using the combination.

This removes the use of `sort-imports` rule and adds alphabetical sorting directly under the `import` plugin which means all the sorting is handled in one place.

The rules for sorting of the imports are now following:
- imports are separated into groups by a type of the import
- imports within the groups are ordered alphabetically in ascending order
- new lines separating the groups of imports are enforced
- the import of React library is always at the very top of the imports
2022-12-02 16:29:58 +01:00
regexowl
c6902ab347 ESLint: Set rules for import order
Fixes #795. This commit adds rules to `.eslintrc.yml` which enforce sorting of the import declarations.

Added plugin `eslint-plugin-import` allows to sort the import declarations based on their types (builtin, external, internal, etc.) and rule `sort-imports` then sorts the declarations inside these groups alphabetically.
2022-09-14 13:24:38 +02:00
Jacob Kozol
7959f2a563 eslintrc: update eslint config
Use the "@redhat-cloud-services/eslint-config-redhat-cloud-services"
eslint config. This allows our styling to be standardized with other
Red Hat Insights apps. Also, remove now unneeded eslint packages.
2022-05-23 12:47:20 +02:00
Jacob Kozol
7b1f5c7e71 package.json: update babel-eslint to @babel/eslint-parser
`babel-eslint` is deprecated and is now `@babel/eslint-parser`. This is
updated in our pacakge.json and eslint config.
2022-03-02 09:59:19 +01:00
Sanne Raymaekers
2e5eaa85d9 package.json: Pin exact versions 2021-04-12 15:58:58 +02:00
Aleksandar Todorov
7639452298 tests: Spy on history.push instead of trying to assert page change
When the SUT calls history.push that will cause a page redirect
inside the browser. However it doesn't cause the new page to be
rendered when running the test suite hence all assertions fail!

The reason for this is that Jest + RTL use jsdom under the hood,
which partially implements HTML/DOM APIs but **IS NOT** a browser!

It also turns out RTL is not well suited for end-to-end scenarios
which cover multiple pages.

This commit:

- patches renderWithReduxRouter() to also return the history object
  so we can set a spy on it later
- changes eslint confirugration to ignore unused variables starting
  with underscore
- updates the verifyCancelButton() function and scenarios which
  make use of it
2020-11-30 13:32:40 +02:00
Sanne Raymaekers
abb3bbc868 test: Make sure the status of a compose is called status
This was a bit confusing because in the inline documentation, I wrote
that a compose used state as a key. However this changed to status
pretty early on and I forgot to update it.

Also use an actual uuid with proper length.
2020-11-10 12:34:30 +02:00
Sanne Raymaekers
a39304a3ba eslint: jsx-tag-spacing and jsx-closing-bracket-location rules 2020-11-09 18:25:51 +01:00
sanne raymaekers
f93d36b972 copy from RedHatInsights/insights-frontend-starter-app template
Copied removing unused parts, and includes some initial changes.
2020-04-15 12:46:02 +02:00