-
Notifications
You must be signed in to change notification settings - Fork 0
Upgrade ESLint #529
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
Merged
Merged
Upgrade ESLint #529
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
7488d42
Upgrade to ESLint 9
alexeyr 5327b0a
Remove unneeded compatibility
alexeyr 75d6b85
Don't lint gitignored files
alexeyr 40daa57
Fix Jest and globals ESLint config
alexeyr ac5e3cf
Get more up-to-date Node in CircleCI
alexeyr eff80f2
Improve typescript-eslint parser config
alexeyr 55275fc
Update lines-between-class-members config
alexeyr File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,4 +1,4 @@ | ||
| FROM ruby:3.3.0 | ||
| FROM ruby:3.3.7 | ||
|
|
||
| RUN apt-get update | ||
|
|
||
|
|
||
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -486,7 +486,7 @@ DEPENDENCIES | |
| yard | ||
|
|
||
| RUBY VERSION | ||
| ruby 3.3.0p0 | ||
| ruby 3.3.7p123 | ||
|
|
||
| BUNDLED WITH | ||
| 2.5.4 | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,177 @@ | ||
| import path from 'node:path'; | ||
| import { includeIgnoreFile } from '@eslint/compat'; | ||
| import js from '@eslint/js'; | ||
| import { FlatCompat } from '@eslint/eslintrc'; | ||
| import { defineConfig, globalIgnores } from 'eslint/config'; | ||
| import importPlugin from 'eslint-plugin-import'; | ||
| import jest from 'eslint-plugin-jest'; | ||
| import prettierRecommended from 'eslint-plugin-prettier/recommended'; | ||
| import globals from 'globals'; | ||
| import typescriptEslint from 'typescript-eslint'; | ||
|
|
||
| const compat = new FlatCompat({ | ||
| baseDirectory: import.meta.dirname, | ||
| recommendedConfig: js.configs.recommended, | ||
| allConfig: js.configs.all, | ||
| }); | ||
|
|
||
| export default defineConfig([ | ||
| includeIgnoreFile(path.resolve(import.meta.dirname, '.gitignore')), | ||
| globalIgnores([ | ||
| '**/node_modules', | ||
| '**/coverage', | ||
| 'gen-documentation/**/*', | ||
| 'spec/react_on_rails/dummy-for-generators', | ||
| 'spec/dummy', | ||
| 'spec/execjs-compatible-dummy', | ||
| 'packages/node-renderer/lib/', | ||
| 'packages/node-renderer/tests/fixtures', | ||
| 'packages/node-renderer/webpack.config.js', | ||
| '**/node_modules/**/*', | ||
| '**/assets/webpack/**/*', | ||
| '**/generated/**/*', | ||
| '**/app/assets/javascripts/application.js', | ||
| '**/coverage/**/*', | ||
| '**/cable.js', | ||
| '**/public/**/*', | ||
| '**/tmp/**/*', | ||
| '**/vendor', | ||
| '**/dist', | ||
| '**/.yalc/', | ||
| ]), | ||
| { | ||
| files: ['**/*.[jt]s', '**/*.[cm][jt]s', '**/*.[jt]sx'], | ||
| }, | ||
| js.configs.recommended, | ||
| compat.extends('eslint-config-shakacode'), | ||
| { | ||
| languageOptions: { | ||
| globals: globals.node, | ||
|
|
||
| parserOptions: { | ||
| // We have @babel/eslint-parser from eslint-config-shakacode, but don't use Babel in the main project | ||
| requireConfigFile: false, | ||
| }, | ||
| }, | ||
|
|
||
| settings: { | ||
| 'import/extensions': ['.js', '.ts'], | ||
|
|
||
| 'import/parsers': { | ||
| '@typescript-eslint/parser': ['.ts'], | ||
| }, | ||
|
|
||
| 'import/resolver': { | ||
| node: true, | ||
| typescript: true, | ||
| }, | ||
| }, | ||
|
|
||
| rules: { | ||
| 'no-console': 'off', | ||
|
|
||
| 'no-void': [ | ||
| 'error', | ||
| { | ||
| // Allow using void to suppress errors about misused promises | ||
| allowAsStatement: true, | ||
| }, | ||
| ], | ||
|
|
||
| // Allow using void to suppress errors about misused promises | ||
| 'no-restricted-syntax': 'off', | ||
| // https://github.com/benmosher/eslint-plugin-import/issues/340 | ||
| 'import/no-extraneous-dependencies': 'off', | ||
| 'import/extensions': 'off', | ||
| 'import/prefer-default-export': 'off', | ||
| 'lines-between-class-members': [ | ||
| 'error', | ||
| { | ||
| enforce: [ | ||
| { blankLine: 'always', prev: '*', next: '*' }, | ||
| { blankLine: 'never', prev: 'field', next: 'field' }, | ||
| ], | ||
| }, | ||
| ], | ||
| 'no-mixed-operators': 'off', | ||
| }, | ||
| }, | ||
| { | ||
| files: ['**/*.ts{x,}'], | ||
| extends: [importPlugin.flatConfigs.typescript, typescriptEslint.configs.strictTypeChecked], | ||
|
|
||
| languageOptions: { | ||
| parserOptions: { | ||
| projectService: true, | ||
| }, | ||
| }, | ||
|
|
||
| rules: { | ||
| '@typescript-eslint/restrict-template-expressions': 'off', | ||
|
|
||
| '@typescript-eslint/no-unused-vars': [ | ||
| 'error', | ||
| { | ||
| argsIgnorePattern: '^_', | ||
| caughtErrorsIgnorePattern: '^_', | ||
| }, | ||
| ], | ||
|
|
||
| '@typescript-eslint/no-floating-promises': [ | ||
| 'error', | ||
| { | ||
| allowForKnownSafePromises: [ | ||
| { | ||
| from: 'package', | ||
| package: 'fastify', | ||
| name: 'FastifyReply', | ||
| }, | ||
| ], | ||
| }, | ||
| ], | ||
|
|
||
| 'no-shadow': 'off', | ||
| '@typescript-eslint/no-shadow': 'error', | ||
| }, | ||
| }, | ||
| { | ||
| files: ['packages/node-renderer/tests/**'], | ||
|
|
||
| plugins: { | ||
| jest, | ||
| }, | ||
|
|
||
| languageOptions: { | ||
| globals: globals.jest, | ||
| }, | ||
|
|
||
| rules: { | ||
| // Allows Jest mocks before import | ||
| 'import/first': 'off', | ||
| 'jest/no-disabled-tests': 'warn', | ||
| 'jest/no-focused-tests': 'error', | ||
| 'jest/no-identical-title': 'error', | ||
| 'jest/prefer-to-have-length': 'warn', | ||
| 'jest/valid-expect': 'error', | ||
| // Simplifies test code | ||
| '@typescript-eslint/no-non-null-assertion': 'off', | ||
| }, | ||
| }, | ||
| { | ||
| files: ['packages/node-renderer/src/integrations/**'], | ||
| ignores: ['packages/node-renderer/src/integrations/api.ts'], | ||
|
|
||
| rules: { | ||
| // Integrations should only use the public integration API | ||
| 'no-restricted-imports': [ | ||
| 'error', | ||
| { | ||
| patterns: ['../*'], | ||
| }, | ||
| ], | ||
| }, | ||
| }, | ||
| // must be the last config in the array | ||
| // https://github.com/prettier/eslint-plugin-prettier?tab=readme-ov-file#configuration-new-eslintconfigjs | ||
| prettierRecommended, | ||
| ]); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -532,7 +532,7 @@ DEPENDENCIES | |
| webmock | ||
|
|
||
| RUBY VERSION | ||
| ruby 3.3.0p0 | ||
| ruby 3.3.7p123 | ||
|
|
||
| BUNDLED WITH | ||
| 2.5.4 | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The previous version includes Node 20.10, which doesn't have
import.meta.dirname. Other Ruby version changes are for consistency with it.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Or I could replace
import.meta.dirnamewith the older approach.