-
Notifications
You must be signed in to change notification settings - Fork 12
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
streamline TS; prettier via eslint #60
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,3 +2,4 @@ node_modules | |
.idea | ||
.DS_Store | ||
yarn-error.log | ||
.vscode |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -11,8 +11,11 @@ | |
}, | ||
"dependencies": { | ||
"babel-eslint": "^9.0.0", | ||
"eslint-config-prettier": "^6.0.0", | ||
"eslint-plugin-import": "^2.8.0", | ||
"eslint-plugin-jest": "^22.5.1" | ||
"eslint-plugin-jest": "^22.5.1", | ||
"eslint-plugin-prettier": "^3.1.0", | ||
"prettier": "^1.18.2" | ||
}, | ||
"peerDependencies": { | ||
"eslint": ">=5.16.0 <6" | ||
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. I think you have to update the peerDeps here if you're introducing version 6. Not sure why I did this range style instead of just the caret. |
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,9 @@ | ||
module.exports = { | ||
extends: ['eslint-config-1stdibs-base', './rules/react', './rules/flowtype'].map( | ||
require.resolve | ||
), | ||
extends: ['eslint-config-1stdibs-base', './rules/react'].map(require.resolve), | ||
overrides: [ | ||
{ | ||
files: ['*.{js,jsx}'], | ||
extends: ['./rules/flowtype'].map(require.resolve), | ||
}, | ||
], | ||
}; |
This file was deleted.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,27 @@ | ||
module.exports = { | ||
plugins: ['@typescript-eslint/eslint-plugin'], | ||
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. You can't combine this file and the index file? 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. I'll play around with it a bit more. 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. Perhaps I'm simply not up-to-date on how So, the way I worked around that was to create a typescript file and the consumer needs to add an override, ie: module.exports = {
extends: ['eslint-config-1stdibs'],
overrides: [
{
files: ['*.{ts,tsx}'],
extends: ['eslint-config-1stdibs/typescript'].map(require.resolve),
parser: '@typescript-eslint/parser',
parserOptions: {
project: './tsconfig.json',
},
},
],
}; 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 consumers will have one .eslintrc file then? Do you need the 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. Yup. One file. |
||
parser: '@typescript-eslint/parser', // Specifies the ESLint parser | ||
extends: [ | ||
'eslint-config-1stdibs-base', | ||
'plugin:@typescript-eslint/recommended', | ||
'./rules/typescript.js', | ||
'./rules/react.js', | ||
'prettier/@typescript-eslint', // Uses eslint-config-prettier to disable ESLint rules from @typescript-eslint/eslint-plugin that would conflict with prettier | ||
'plugin:import/typescript', | ||
], | ||
rules: { | ||
'react/prop-types': 'off', | ||
// note you must disable the base rule as it can report incorrect errors | ||
camelcase: 'off', | ||
'@typescript-eslint/camelcase': 'off', | ||
'@typescript-eslint/explicit-member-accessibility': 'warn', | ||
'@typescript-eslint/no-explicit-any': 'warn', | ||
'@typescript-eslint/prefer-interface': 'off', | ||
'@typescript-eslint/explicit-function-return-type': [ | ||
'error', | ||
{ | ||
allowExpressions: true, | ||
allowTypedFunctionExpressions: true, | ||
}, | ||
], | ||
'@typescript-eslint/indent': 'off', | ||
}, | ||
}; |
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.
This is marked as a dev/peerDep in the individual packages. You'll need to update those references as well.