-
-
Couldn't load subscription status.
- Fork 638
Upgrade ESLint #1713
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 #1713
Changes from all commits
Commits
Show all changes
14 commits
Select commit
Hold shift + click to select a range
36c7ceb
Upgrade eslint-config-shakacode
alexeyr 1c4bb81
Upgrade to ESLint 8
alexeyr 16aaf12
Upgrade to ESLint 9
alexeyr c952995
Disable some unneeded rules
alexeyr 1b647d0
Auto-fixes
alexeyr f24b4bf
Fix issues
alexeyr f0e39df
Fix CI issues
alexeyr bd4857a
Enable ESLint on config files
alexeyr 2365818
Fix Knip config
alexeyr 9e76ca7
Remove fixed issue in Knip config
alexeyr a0097b7
Update Knip
alexeyr b6499ba
More CI issues
alexeyr 476cd23
More CI cleanup
alexeyr f164ef7
Enable ESLint on generator templates
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 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
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 |
|---|---|---|
| @@ -0,0 +1,163 @@ | ||
| import { globalIgnores } from 'eslint/config'; | ||
| import prettierRecommended from 'eslint-plugin-prettier/recommended'; | ||
| import globals from 'globals'; | ||
| import tsEslint from 'typescript-eslint'; | ||
| import js from '@eslint/js'; | ||
| import { FlatCompat } from '@eslint/eslintrc'; | ||
|
|
||
| const compat = new FlatCompat({ | ||
| baseDirectory: __dirname, | ||
| recommendedConfig: js.configs.recommended, | ||
| allConfig: js.configs.all, | ||
| }); | ||
|
|
||
| const config = tsEslint.config([ | ||
| globalIgnores([ | ||
| // compiled code | ||
| 'node_package/lib/', | ||
| // used for tests only | ||
| 'spec/react_on_rails/dummy-for-generators', | ||
| // temporary and generated files | ||
| 'spec/dummy/.yalc', | ||
| 'spec/dummy/public', | ||
| 'spec/dummy/vendor', | ||
| 'spec/dummy/tmp', | ||
| 'spec/dummy/app/assets/config/manifest.js', | ||
| 'spec/dummy/client/app/packs/server-bundle.js', | ||
| '**/*.res.js', | ||
| '**/coverage', | ||
| '**/assets/webpack/**/*', | ||
| '**/public/webpack/**/*', | ||
| '**/generated/**/*', | ||
| '**/app/assets/javascripts/application.js', | ||
| '**/cable.js', | ||
| '**/public/packs*/*', | ||
| '**/gen-examples/', | ||
| '**/bundle/', | ||
| // dependencies | ||
| '**/node_modules/**/*', | ||
| ]), | ||
| { | ||
| files: ['**/*.[jt]s', '**/*.[jt]sx', '**/*.[cm][jt]s'], | ||
| }, | ||
| js.configs.recommended, | ||
| compat.extends('eslint-config-shakacode'), | ||
| { | ||
| languageOptions: { | ||
| globals: { | ||
| ...globals.browser, | ||
| ...globals.node, | ||
| ...globals.mocha, | ||
| ...globals.jest, | ||
| __DEBUG_SERVER_ERRORS__: true, | ||
| __SERVER_ERRORS__: true, | ||
| }, | ||
|
|
||
| parserOptions: { | ||
| requireConfigFile: false, | ||
|
|
||
| babelOptions: { | ||
| presets: ['@babel/preset-env', '@babel/preset-react'], | ||
| }, | ||
| }, | ||
| }, | ||
|
|
||
| settings: { | ||
| 'import/core-modules': ['react-redux'], | ||
|
|
||
| 'import/resolver': { | ||
| alias: [['Assets', './spec/dummy/client/app/assets']], | ||
|
|
||
| node: { | ||
| extensions: ['.js', '.jsx', '.ts', '.d.ts'], | ||
| }, | ||
| }, | ||
| }, | ||
|
|
||
| rules: { | ||
| 'no-shadow': 'off', | ||
| 'no-console': 'off', | ||
| 'function-paren-newline': 'off', | ||
| 'object-curly-newline': 'off', | ||
| 'no-restricted-syntax': ['error', 'SequenceExpression'], | ||
|
|
||
| 'import/extensions': [ | ||
| 'error', | ||
| 'ignorePackages', | ||
| { | ||
| js: 'never', | ||
| jsx: 'never', | ||
| ts: 'never', | ||
| }, | ||
| ], | ||
|
|
||
| 'import/first': 'off', | ||
| 'import/no-extraneous-dependencies': 'off', | ||
| // The rule seems broken: it's reporting errors on imports in files using `export` too, | ||
| // not just `module.exports`. | ||
| 'import/no-import-module-exports': 'off', | ||
| 'import/no-unresolved': [ | ||
| 'error', | ||
| { | ||
| ignore: ['\\.res\\.js$'], | ||
| }, | ||
| ], | ||
| 'react/destructuring-assignment': [ | ||
| 'error', | ||
| 'always', | ||
| { | ||
| ignoreClassFields: true, | ||
| }, | ||
| ], | ||
| 'react/forbid-prop-types': 'off', | ||
| 'react/function-component-definition': [ | ||
| 'error', | ||
| { | ||
| namedComponents: ['arrow-function', 'function-declaration'], | ||
| unnamedComponents: 'arrow-function', | ||
| }, | ||
| ], | ||
| 'react/jsx-props-no-spreading': 'off', | ||
| 'react/static-property-placement': 'off', | ||
| 'jsx-a11y/anchor-is-valid': 'off', | ||
| }, | ||
| }, | ||
| { | ||
| files: ['lib/generators/react_on_rails/templates/**/*'], | ||
| rules: { | ||
| // It doesn't use package.json from the template | ||
| 'import/no-unresolved': 'off', | ||
| // We have `const [name, setName] = useState(props.name)` so can't just destructure props | ||
| 'react/destructuring-assignment': 'off', | ||
| }, | ||
| }, | ||
| { | ||
| files: ['**/*.ts', '**/*.tsx'], | ||
|
|
||
| extends: tsEslint.configs.recommended, | ||
|
|
||
| languageOptions: { | ||
| parserOptions: { | ||
| projectService: { | ||
| allowDefaultProject: ['eslint.config.ts', 'knip.ts'], | ||
| }, | ||
| }, | ||
| }, | ||
|
|
||
| rules: { | ||
| '@typescript-eslint/no-namespace': 'off', | ||
| '@typescript-eslint/no-shadow': 'error', | ||
| '@typescript-eslint/no-unused-vars': [ | ||
| 'error', | ||
| { | ||
| caughtErrorsIgnorePattern: '^_', | ||
| }, | ||
| ], | ||
| }, | ||
| }, | ||
| // must be the last config in the array | ||
| // https://github.com/prettier/eslint-plugin-prettier?tab=readme-ov-file#configuration-new-eslintconfigjs | ||
| prettierRecommended, | ||
| ]); | ||
|
|
||
| export default config; | ||
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
2 changes: 1 addition & 1 deletion
2
...ails/templates/redux/base/app/javascript/bundles/HelloWorld/reducers/helloWorldReducer.js
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
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
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,5 +1,3 @@ | ||
| /* eslint-disable react/prop-types */ | ||
|
|
||
| import * as React from 'react'; | ||
| import type { | ||
| ServerRenderResult, | ||
|
|
||
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.