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.
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.
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
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.
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.
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
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.