-
Notifications
You must be signed in to change notification settings - Fork 163
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
ci(lint): Move eslint config to root. Add GH workflow to run lint. (#…
…1109) - auto-fix minor lint warnings.
- Loading branch information
Showing
39 changed files
with
475 additions
and
6,359 deletions.
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 |
---|---|---|
@@ -0,0 +1,13 @@ | ||
**/*.d.ts | ||
packages/**/dist/**/* | ||
packages/**/public/**/* | ||
packages/**/coverage/**/* | ||
packages/**/fixtures/**/* | ||
node_modules | ||
# TODO Disable examples, we want to include it. | ||
examples/**/* | ||
public/**/* | ||
scripts/**/* | ||
.github | ||
.changeset | ||
vite.config.js |
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,18 +1,156 @@ | ||
module.exports = { | ||
extends: [__dirname+'/config/defaultEslintConfig.cjs'], | ||
parserOptions: { | ||
project: './tsconfig.eslint.json', | ||
tsconfigRootDir: __dirname, | ||
parser: '@typescript-eslint/parser', | ||
root: true, | ||
extends: [ | ||
// 'standard', | ||
'plugin:react/recommended', | ||
'plugin:react-hooks/recommended', | ||
'eslint:recommended', | ||
'plugin:@typescript-eslint/eslint-recommended', | ||
'plugin:@typescript-eslint/recommended', | ||
//'plugin:@typescript-eslint/recommended-type-checked', //ideally we want this on | ||
// 'plugin:@typescript-eslint/stylistic-type-checked', | ||
'plugin:import/typescript', | ||
'plugin:jsx-a11y/recommended', | ||
'prettier', // must be last | ||
], | ||
plugins: ['@typescript-eslint', 'simple-import-sort', 'testing-library', 'react', 'prettier'], | ||
parserOptions: { | ||
project: ['./tsconfig.eslint.json', './packages/*/tsconfig.eslint.json'], | ||
ecmaVersion: 2022, | ||
sourceType: 'module', | ||
ecmaFeatures: { | ||
jsx: true, | ||
}, | ||
rules: { | ||
'@typescript-eslint/naming-convention': [ | ||
'error', | ||
{ | ||
'selector': 'variable', | ||
'types': ['boolean'], | ||
'format': ['PascalCase'], | ||
'prefix': ['is', 'with', 'should', 'has', 'can', 'did', 'will'] | ||
} | ||
] | ||
} | ||
} | ||
warnOnUnsupportedTypeScriptVersion: true, | ||
}, | ||
rules: { | ||
// '@typescript-eslint/naming-convention': [ | ||
// 'error', | ||
// { | ||
// selector: 'variable', | ||
// types: ['boolean'], | ||
// format: ['PascalCase'], | ||
// prefix: ['is', 'with', 'should', 'has', 'can', 'did', 'will'], | ||
// }, | ||
// ], | ||
'@typescript-eslint/interface-name-prefix': 'off', | ||
'@typescript-eslint/no-non-null-assertion': 'off', | ||
'@typescript-eslint/explicit-module-boundary-types': 'off', | ||
'@typescript-eslint/no-explicit-any': 'off', | ||
'@typescript-eslint/ban-ts-comment': 'off', | ||
'no-unused-vars': 'off', | ||
'@typescript-eslint/no-unused-vars': [ | ||
'error', | ||
{ | ||
argsIgnorePattern: '^_|req|res|next|err|ctx|args|context|info|index|data', | ||
ignoreRestSiblings: true, | ||
}, | ||
], | ||
'no-array-constructor': 'off', | ||
'@typescript-eslint/no-array-constructor': 'warn', | ||
'no-redeclare': 'off', | ||
'@typescript-eslint/no-redeclare': 'warn', | ||
'no-use-before-define': 'off', | ||
'@typescript-eslint/no-use-before-define': [ | ||
'warn', | ||
{ | ||
functions: false, | ||
classes: false, | ||
variables: false, | ||
typedefs: false, | ||
}, | ||
], | ||
'no-unused-expressions': 'off', | ||
'@typescript-eslint/no-unused-expressions': [ | ||
'error', | ||
{ | ||
allowShortCircuit: true, | ||
allowTernary: true, | ||
allowTaggedTemplates: true, | ||
}, | ||
], | ||
'@typescript-eslint/triple-slash-reference': 'off', | ||
'@typescript-eslint/member-delimiter-style': [ | ||
'error', | ||
{ | ||
multiline: { | ||
delimiter: 'semi', | ||
requireLast: true, | ||
}, | ||
singleline: { | ||
delimiter: 'semi', | ||
requireLast: false, | ||
}, | ||
}, | ||
], | ||
camelcase: 'off', | ||
'comma-dangle': [ | ||
'error', | ||
{ | ||
arrays: 'always-multiline', | ||
objects: 'always-multiline', | ||
imports: 'always-multiline', | ||
exports: 'always-multiline', | ||
functions: 'always-multiline', | ||
}, | ||
], | ||
'array-callback-return': 'warn', | ||
'jsx-quotes': ['error', 'prefer-double'], | ||
// 'max-len': ['error', { code: 120 }], | ||
indent: 'off', | ||
// quotes: ['error', 'single'], | ||
semi: ['error', 'always'], | ||
'space-before-function-paren': 'off', | ||
|
||
'import/no-named-as-default': 'off', | ||
'import/no-named-as-default-member': 'off', | ||
'import/default': 'off', | ||
'import/named': 'off', | ||
'import/namespace': 'off', | ||
'import/no-unresolved': 'off', | ||
'simple-import-sort/imports': 'error', | ||
'simple-import-sort/exports': 'error', | ||
'react/prop-types': 'off', | ||
'react/jsx-wrap-multilines': 'error', | ||
'react/react-in-jsx-scope': 'off', | ||
'react/display-name': 'off', | ||
// https://github.com/facebook/react/tree/master/packages/-react-hooks | ||
'react-hooks/rules-of-hooks': 'error', | ||
'react-hooks/exhaustive-deps': 'off', | ||
}, | ||
|
||
overrides: [ | ||
{ | ||
files: ['*.js', '*.jsx'], | ||
rules: { | ||
'@typescript-eslint/no-var-requires': 'off', | ||
}, | ||
}, | ||
{ | ||
// 3) Now we enable -testing-library rules or preset only for matching files! | ||
files: ['**/?(*.)+(spec|test).[jt]s?(x)'], | ||
extends: ['plugin:testing-library/react'], | ||
rules: { | ||
'testing-library/await-async-query': 'error', | ||
'testing-library/no-await-sync-query': 'error', | ||
'testing-library/no-debugging-utils': 'warn', | ||
'testing-library/no-dom-import': 'off', | ||
'testing-library/no-unnecessary-act': 'off', | ||
}, | ||
}, | ||
], | ||
settings: { | ||
react: { | ||
version: 'detect', | ||
}, | ||
// 'import/parsers': { | ||
// '@typescript-eslint/parser': ['.ts', '.tsx'], | ||
// }, | ||
'import/resolver': { | ||
typescript: { | ||
alwaysTryTypes: true, | ||
}, | ||
}, | ||
}, | ||
}; |
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,45 @@ | ||
name: Lint | ||
|
||
on: | ||
# Trigger the workflow on push or pull request, | ||
# but only for the main branch | ||
push: | ||
# branches: | ||
# - main | ||
pull_request: | ||
# branches: | ||
# - main | ||
|
||
env: | ||
PNPM_VERSION: 8.5.1 | ||
NODE_VERSION: 18 | ||
|
||
jobs: | ||
run-linters: | ||
name: Run linters | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Check out Git repository | ||
uses: actions/checkout@v3 | ||
|
||
- name: Install node.js | ||
uses: actions/setup-node@v3 | ||
with: | ||
node-version: ${{ env.NODE_VERSION }} | ||
|
||
- uses: pnpm/action-setup@v2 | ||
name: Install pnpm | ||
with: | ||
version: ${{ env.PNPM_VERSION }} | ||
run_install: false | ||
|
||
# ESLint and Prettier must be in `package.json` | ||
- name: Install dependencies | ||
run: pnpm i | ||
|
||
- name: Run linters | ||
uses: wearerequired/lint-action@v2 | ||
with: | ||
eslint: true | ||
prettier: false #runs part of eslint |
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,11 @@ | ||
# deep dirs | ||
**/dist | ||
**/node_modules | ||
**/fixtures | ||
|
||
# directories | ||
.github | ||
.changeset | ||
|
||
# files | ||
pnpm-lock.yaml |
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,18 @@ | ||
module.exports = { | ||
printWidth: 100, | ||
semi: true, | ||
singleQuote: true, | ||
jsxSingleQuote: true, | ||
tabWidth: 2, | ||
trailingComma: 'es5', | ||
useTabs: true, | ||
plugins: [], | ||
overrides: [ | ||
{ | ||
files: ['.*', '*.json', '*.md', '*.toml', '*.yml'], | ||
options: { | ||
useTabs: false, | ||
}, | ||
}, | ||
], | ||
}; |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.