-
Notifications
You must be signed in to change notification settings - Fork 16
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
Use shared eslint config #2564
Draft
adrianschmidt
wants to merge
7
commits into
main
Choose a base branch
from
use-shared-eslint-config
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
Use shared eslint config #2564
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
47cf48e
chore: use @limetech/eslint-config
adrianschmidt 41e932b
chore: replace `.prettierrc` with symlink
adrianschmidt 9317e09
style: automatic lint fixes
adrianschmidt dcd9794
chore: update `@limetech/eslint-config` from v2.0.0 to v2.0.1
adrianschmidt 66145c8
chore: replace jsdoc with tsdoc
adrianschmidt 71a2a46
chore: update kompendium to version supporting tsdoc
adrianschmidt cbece01
docs: convert jsdoc strings to tsdoc
adrianschmidt 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 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,199 +1,4 @@ | ||
/* eslint-env node */ | ||
module.exports = { | ||
env: { | ||
browser: true, | ||
es2020: true, | ||
}, | ||
extends: [ | ||
'eslint:recommended', | ||
'plugin:@typescript-eslint/eslint-recommended', | ||
'plugin:prettier/recommended', | ||
'plugin:sonarjs/recommended', | ||
'plugin:jsdoc/recommended', | ||
], | ||
parser: '@typescript-eslint/parser', | ||
parserOptions: { | ||
ecmaVersion: 2020, | ||
sourceType: 'module', | ||
}, | ||
plugins: [ | ||
'@typescript-eslint', | ||
'prettier', | ||
'sonarjs', | ||
'jsdoc', | ||
'prefer-arrow', | ||
'ban', | ||
], | ||
settings: { | ||
react: { | ||
version: '16.14', | ||
pragma: 'h', | ||
}, | ||
}, | ||
rules: { | ||
quotes: ['error', 'single', { avoidEscape: true }], | ||
semi: ['error', 'always'], | ||
'prettier/prettier': 'error', | ||
'@typescript-eslint/no-unused-vars': [ | ||
'error', | ||
{ varsIgnorePattern: '^h$' }, | ||
], | ||
'@typescript-eslint/array-type': [ | ||
'error', | ||
{ | ||
default: 'array-simple', | ||
}, | ||
], | ||
'@typescript-eslint/consistent-type-assertions': 'error', | ||
'@typescript-eslint/no-explicit-any': 'off', | ||
'@typescript-eslint/prefer-for-of': 'error', | ||
'@typescript-eslint/prefer-function-type': 'error', | ||
'@typescript-eslint/unified-signatures': 'error', | ||
'@typescript-eslint/no-unused-expressions': 'error', | ||
'no-unused-vars': 'off', | ||
camelcase: 'error', | ||
'comma-dangle': [ | ||
'error', | ||
{ | ||
arrays: 'always-multiline', | ||
functions: 'never', | ||
objects: 'always-multiline', | ||
imports: 'always-multiline', | ||
exports: 'always-multiline', | ||
}, | ||
], | ||
curly: 'error', | ||
'default-case': 'error', | ||
eqeqeq: ['error', 'always'], | ||
'guard-for-in': 'error', | ||
'id-match': 'error', | ||
'jsdoc/check-indentation': 'error', | ||
'jsdoc/require-jsdoc': 'off', | ||
'jsdoc/no-undefined-types': 'off', | ||
'jsdoc/check-tag-names': 'off', | ||
'max-classes-per-file': ['error', 1], | ||
'multiline-ternary': ['error', 'never'], | ||
'no-bitwise': 'error', | ||
'no-caller': 'error', | ||
'no-console': 'error', | ||
'no-duplicate-imports': 'error', | ||
'no-eval': 'error', | ||
'no-extra-bind': 'error', | ||
'no-magic-numbers': [ | ||
'error', | ||
{ | ||
ignore: [-1, 0, 1], | ||
ignoreArrayIndexes: true, | ||
}, | ||
], | ||
'no-new-func': 'error', | ||
'no-new-wrappers': 'error', | ||
'no-return-await': 'error', | ||
'no-sequences': 'error', | ||
'no-shadow': 'off', | ||
'@typescript-eslint/no-shadow': [ | ||
'error', | ||
{ | ||
hoist: 'all', | ||
}, | ||
], | ||
'no-template-curly-in-string': 'error', | ||
'no-throw-literal': 'error', | ||
'no-underscore-dangle': 'error', | ||
'no-var': 'error', | ||
'object-shorthand': ['error', 'never'], | ||
'one-var': ['error', 'never'], | ||
'padding-line-between-statements': [ | ||
'error', | ||
{ blankLine: 'always', prev: '*', next: 'return' }, | ||
{ blankLine: 'always', prev: '*', next: 'function' }, | ||
{ | ||
blankLine: 'always', | ||
prev: 'multiline-block-like', | ||
next: '*', | ||
}, | ||
], | ||
'prefer-arrow/prefer-arrow-functions': [ | ||
'error', | ||
{ | ||
allowStandaloneDeclarations: true, | ||
}, | ||
], | ||
'prefer-const': 'error', | ||
'prefer-object-spread': 'error', | ||
radix: 'error', | ||
'spaced-comment': [ | ||
'error', | ||
'always', | ||
{ | ||
markers: ['/'], | ||
}, | ||
], | ||
}, | ||
overrides: [ | ||
{ | ||
files: ['./*.js'], | ||
rules: { | ||
'no-unused-vars': 'error', | ||
'sonarjs/no-duplicate-string': 'off', | ||
}, | ||
}, | ||
{ | ||
files: ['./*.ts'], | ||
rules: { | ||
'sonarjs/no-duplicate-string': 'off', | ||
}, | ||
}, | ||
{ | ||
files: ['src/**/*.{ts,tsx}'], | ||
parser: '@typescript-eslint/parser', | ||
parserOptions: { | ||
parserOption: { | ||
jsx: true, | ||
}, | ||
project: 'tsconfig.json', | ||
}, | ||
rules: { | ||
'@typescript-eslint/dot-notation': 'error', | ||
}, | ||
}, | ||
{ | ||
files: [ | ||
'src/examples/*.{ts,tsx}', | ||
'src/components/**/examples/*.{ts,tsx}', | ||
'src/components/**/examples/**/*.{ts,tsx}', | ||
'src/**/*.spec.{ts,tsx}', | ||
'src/**/*.e2e.{ts,tsx}', | ||
'src/**/*.test-wrapper.{ts,tsx}', | ||
], | ||
parserOptions: { | ||
parserOption: { | ||
jsx: true, | ||
}, | ||
project: 'tsconfig.lint.json', | ||
}, | ||
rules: { | ||
'@typescript-eslint/dot-notation': 'error', | ||
'sonarjs/no-duplicate-string': 'off', | ||
'sonarjs/no-identical-functions': 'off', | ||
'jsdoc/require-returns': 'off', | ||
'jsdoc/require-param': 'off', | ||
'no-console': 'off', | ||
'no-magic-numbers': 'off', | ||
'prefer-arrow/prefer-arrow-functions': 'off', | ||
'ban/ban': [ | ||
'error', | ||
{ | ||
name: ['describe', 'only'], | ||
message: "don't focus tests", | ||
}, | ||
{ name: 'fdescribe', message: "don't focus tests" }, | ||
{ name: ['it', 'only'], message: "don't focus tests" }, | ||
{ name: 'fit', message: "don't focus tests" }, | ||
{ name: ['test', 'only'], message: "don't focus tests" }, | ||
{ name: 'ftest', message: "don't focus tests" }, | ||
], | ||
}, | ||
}, | ||
], | ||
extends: ['@limetech/eslint-config'], | ||
}; |
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
Binary file not shown.
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.
Does this work on Windows (using a symlink that is)? Can you help me out by checking @mjlime?
Just pull this branch down, run
npm i
andnpm run lint
. If it doesn't work, you should be getting either an error about there being something wrong with your.prettierrc
, or, as I got when I simply removed the symlink, 7,674 lint errors 😆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.
I just tested, and it works when running on Windows in GitHub actions at least 👍
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.
Doesn't look like it works:
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.
Hmm… that's a weird error… it seems the symlink worked, because it complains about not finding modules referenced from the symlinked file.
Which npm version are you running?
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.
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.
Ah crap… I was hoping you were using npm <7, because then the problem would have simply been that peer dependencies didn't get installed automatically.
But since that isn't the case, I don't know what the problem is, and that makes me sad… 😢
I'll look into if we can maybe copy the
.prettierrc
from@limetech/eslint-config
to the consumer package in the postinstall… 🤔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.
@mjlime Ok, now it ought to work. I've put the normal
.prettierrc
back, and I also put a post-install script in Lundalogik/eslint-config that copies its.prettierrc
to the consumer project, but only if there isn't already a.prettierrc
file there. So it won't overwrite anything.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.
@adrianschmidt Still running into problems (npm 9.8.1, node 18.18.2):
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.
Hmm, removing
.prettierrc
and running it again gave me this:Improvement? You tell me @adrianschmidt
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.
I'm going to need to get myself a Windows VM if I'm ever to get this to work, I think… 🤔