-
Notifications
You must be signed in to change notification settings - Fork 27
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
Port the eslint config from UDR and next-hashicorp #2704
Merged
+1,947
β5,233
Merged
Changes from 1 commit
Commits
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 contains 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,88 @@ | ||
const { node, browser } = require('globals') | ||
const pluginJs = require('@eslint/js') | ||
const tseslint = require('typescript-eslint') | ||
const pluginReact = require('eslint-plugin-react') | ||
const noBarrelFiles = require('eslint-plugin-no-barrel-files') | ||
|
||
module.exports = [ | ||
{ | ||
ignores: [ | ||
'.next', | ||
'**/dist', | ||
'eslint.config.js', | ||
'content', | ||
'public', | ||
'vitest.config.mjs', | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The vitest config file in dev-portal ends in There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Fixed in a2b1e45 |
||
'playwright-report', | ||
], | ||
}, | ||
pluginJs.configs.recommended, | ||
...tseslint.configs.recommended, | ||
pluginReact.configs.flat.recommended, | ||
{ | ||
settings: { react: { version: 'detect' } }, | ||
}, | ||
{ | ||
files: ['**/*.{js,ts,jsx,tsx}'], | ||
languageOptions: { globals: { ...node, ...browser } }, | ||
plugins: { 'no-barrel-files': noBarrelFiles }, | ||
rules: { | ||
// TypeScript's `noFallthroughCasesInSwitch` option is more robust (#6906) | ||
'default-case': 'off', | ||
// 'tsc' already handles this (https://github.com/typescript-eslint/typescript-eslint/issues/291) | ||
'no-dupe-class-members': 'off', | ||
// 'tsc' already handles this (https://github.com/typescript-eslint/typescript-eslint/issues/477) | ||
'no-undef': 'off', | ||
// Add TypeScript specific rules (and turn off ESLint equivalents) | ||
// '@typescript-eslint/no-angle-bracket-type-assertion': 'warn', | ||
'no-array-constructor': 'off', | ||
'@typescript-eslint/no-array-constructor': 'warn', | ||
'@typescript-eslint/no-namespace': 'error', | ||
'no-use-before-define': 'off', | ||
'@typescript-eslint/no-use-before-define': [ | ||
'warn', | ||
{ | ||
functions: false, | ||
classes: false, | ||
variables: false, | ||
typedefs: false | ||
} | ||
], | ||
'no-unused-vars': 'off', | ||
'@typescript-eslint/no-unused-vars': [ | ||
'warn', | ||
{ | ||
args: 'none', | ||
ignoreRestSiblings: true | ||
} | ||
], | ||
'no-useless-constructor': 'off', | ||
'@typescript-eslint/no-useless-constructor': 'warn', | ||
// This is really verbose, and requires the author to add a lot of | ||
// types that are already inferred by Typescript (so you'll see them in | ||
// an IDE like VSCode just fine). We may want it eventually, but I | ||
// suspect it will slow people down when doing page conversions. Note | ||
// that `tslint:recommended` turns this kind of checking off. | ||
'@typescript-eslint/explicit-function-return-type': 'off', | ||
|
||
// Not necessary in Next.js (https://spectrum.chat/next-js/general/react-must-be-in-scope-when-using-jsx~6193ef62-4d5e-4681-8f51-8c7bf6b9d56d) | ||
'react/react-in-jsx-scope': 'off', | ||
}, | ||
}, | ||
{ | ||
files: ['**/*.js?(x)'], | ||
rules: { | ||
// For instances where we aren't using esmodules or TypeScript and therefore can't use import | ||
'@typescript-eslint/no-require-imports': 'off' | ||
}, | ||
}, | ||
{ | ||
files: ['**/*.ts?(x)'], | ||
rules: { | ||
'react/prop-types': 'off', | ||
'react/no-array-index-key': 'warn', | ||
'react/no-unknown-property': ['error', { ignore: ['class'] }] | ||
}, | ||
}, | ||
] | ||
|
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.
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.
dev-portal doesn't have a
content
directory so I think this can be removedThere 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.
Good point! I guess my rip was more shameless than I thought :p
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.
Fixed that in d3d638b