Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Replace TSLint with ESLint and Prettier #2112

Merged
merged 5 commits into from
Apr 21, 2023

Conversation

lucas-koehler
Copy link
Contributor

@lucas-koehler lucas-koehler commented Mar 10, 2023

  • Configure ESLint and Prettier for each package
  • Use ESLint 7.x instead of 8.x because the Angular eslint plugin for Angular 12 does not work with ESLint 8.x
  • Did not apply the formatting yet

#1551

@netlify
Copy link

netlify bot commented Mar 10, 2023

Deploy Preview for jsonforms-examples ready!

Name Link
🔨 Latest commit d447946
🔍 Latest deploy log https://app.netlify.com/sites/jsonforms-examples/deploys/644259ab3cc5f200088f4c73
😎 Deploy Preview https://deploy-preview-2112--jsonforms-examples.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site settings.

@coveralls
Copy link

coveralls commented Mar 10, 2023

Coverage Status

Coverage: 84.254% (-0.4%) from 84.703% when pulling d447946 on lucas-koehler:1551_remove-ts-lint into 8b6c9d2 on eclipsesource:master.

Copy link
Member

@sdirix sdirix left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I tried the configured linter in the various packages.

  • I got a lot of Unexpected any. Specify a different type @typescript-eslint/no-explicit-any warnings reported. Do you intend to fix them with this PR or shall we disable the rule for now to not make the warnings meaningless? This could be handled in a follow up PR then
  • There are a lot of Do not access Object.prototype method 'hasOwnProperty' from target object no-prototype-builtins errors. Do you intend to fix them with this PR?
  • There are warning like '_key' is defined but never used @typescript-eslint/no-unused-vars. Personally I prefer to specify an exception to this rule for variables starting with an underscore. Do you agree? If yes, can you add it?
  • The lint script is also linting config files like rollup.config.js. This should either be avoided or they need specific rules. Personally I would not lint these files.
  • There is warning when running lint in the react packages Warning: React version not specified in eslint-plugin-react settings. See https://github.com/jsx-eslint/eslint-plugin-react#configuration
  • Some of the test files should probably be excluded as they do things like require which the linter doesn't like

Also:

  • Can you add markdownlint to the recommended extensions?
  • There is no linter yet in the vue packages

I think the PR should consist of three commits in the end:

  • A commit adding all the configurations
  • A commit applying all autofixable resolutions
  • A commit fixing all remaining errors and warnings

.prettierrc.js Outdated Show resolved Hide resolved
.vscode/settings.json Outdated Show resolved Hide resolved
packages/core/.eslintrc.js Outdated Show resolved Hide resolved
packages/core/.eslintrc.js Outdated Show resolved Hide resolved
packages/core/.eslintrc.js Show resolved Hide resolved
.vscode/settings.json Outdated Show resolved Hide resolved
@lucas-koehler
Copy link
Contributor Author

@sdirix I improved the config. See the commit messages for the changes. I am going to squash the changes to have the three suggested commits in the end

Copy link
Member

@sdirix sdirix left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM so far

.vscode/extensions.json Show resolved Hide resolved
- Remove TSLint dependencies and config
- Add ESLint and Prettier dependencies and config for all packages
- Add markdownlint to recommended extensions
- Use ESLint 7.x instead of 8.x because the Angular eslint plugin
  for Angular 12 does not work with ESLint 8.x

Disabled rules for to be re-enabled later:
- explicit any warnings
- no-prototype-builtins rule
- import/no-named-as-default for 2 packages
  - vanilla-renderers
  - material-renderers

Part of eclipsesource#1551
Fix remaining ESLint issues with these exceptions that will be handled in a follow up
- import/no-named-as-default in vanilla-renderers, material-renderers
- no-prototype-builtins
- @typescript-eslint/no-explicit-any
- typescript-eslint/ban-types

Part of eclipsesource#1551
@lucas-koehler lucas-koehler marked this pull request as ready for review April 21, 2023 09:49
@lucas-koehler lucas-koehler changed the title Draft: Replace TSLint with ESLint and Prettier Replace TSLint with ESLint and Prettier Apr 21, 2023
Copy link
Member

@sdirix sdirix left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM! Thanks!

@sdirix sdirix merged commit 8c82d78 into eclipsesource:master Apr 21, 2023
@lucas-koehler lucas-koehler deleted the 1551_remove-ts-lint branch April 21, 2023 11:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants