forked from danny-avila/LibreChat
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Build/Refactor: lint pre-commit hook and reformat repo to spec (danny…
…-avila#314) * build/refactor: move lint/prettier packages to project root, install husky, add pre-commit hook * refactor: reformat files * build: put full eslintrc back with all rules
- Loading branch information
1 parent
8d75b25
commit 7fdc862
Showing
157 changed files
with
4,879 additions
and
2,446 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,113 @@ | ||
module.exports = { | ||
env: { | ||
browser: true, | ||
es2021: true, | ||
node: true, | ||
commonjs: true, | ||
es6: true | ||
}, | ||
extends: [ | ||
'eslint:recommended', | ||
'plugin:react/recommended', | ||
'plugin:react-hooks/recommended', | ||
'prettier' | ||
], | ||
parser: '@typescript-eslint/parser', | ||
parserOptions: { | ||
ecmaVersion: 'latest', | ||
sourceType: 'module', | ||
ecmaFeatures: { | ||
jsx: true | ||
} | ||
}, | ||
plugins: ['react', 'react-hooks', '@typescript-eslint'], | ||
rules: { | ||
'@typescript-eslint/ban-ts-comment': ['error', { 'ts-ignore': 'allow-with-description' }], | ||
indent: ['error', 2, { SwitchCase: 1 }], | ||
'max-len': [ | ||
'error', | ||
{ | ||
code: 150, | ||
ignoreStrings: true, | ||
ignoreTemplateLiterals: true, | ||
ignoreComments: true | ||
} | ||
], | ||
'linebreak-style': 0, | ||
// "arrow-parens": [2, "as-needed", { requireForBlockBody: true }], | ||
// 'no-plusplus': ['error', { allowForLoopAfterthoughts: true }], | ||
'no-console': 'off', | ||
'import/extensions': 'off', | ||
'no-use-before-define': [ | ||
'error', | ||
{ | ||
functions: false | ||
} | ||
], | ||
'no-promise-executor-return': 'off', | ||
'no-param-reassign': 'off', | ||
'no-continue': 'off', | ||
'no-restricted-syntax': 'off', | ||
'react/prop-types': ['off'], | ||
'react/display-name': ['off'] | ||
}, | ||
overrides: [ | ||
{ | ||
files: ['**/*.ts', '**/*.tsx'], | ||
rules: { | ||
'no-unused-vars': 'off', // off because it conflicts with '@typescript-eslint/no-unused-vars' | ||
'react/display-name': 'off', | ||
'@typescript-eslint/no-unused-vars': 'warn' | ||
} | ||
}, | ||
{ | ||
files: ['rollup.config.js', '.eslintrc.js', 'jest.config.js'], | ||
env: { | ||
node: true | ||
} | ||
}, | ||
{ | ||
files: [ | ||
'**/*.test.js', | ||
'**/*.test.jsx', | ||
'**/*.test.ts', | ||
'**/*.test.tsx', | ||
'**/*.spec.js', | ||
'**/*.spec.jsx', | ||
'**/*.spec.ts', | ||
'**/*.spec.tsx', | ||
'setupTests.js' | ||
], | ||
env: { | ||
jest: true, | ||
node: true | ||
}, | ||
rules: { | ||
'react/display-name': 'off', | ||
'react/prop-types': 'off', | ||
'react/no-unescaped-entities': 'off' | ||
} | ||
}, | ||
{ | ||
files: '**/*.+(ts)', | ||
parser: '@typescript-eslint/parser', | ||
parserOptions: { | ||
project: './client/tsconfig.json' | ||
}, | ||
plugins: ['@typescript-eslint/eslint-plugin'], | ||
extends: [ | ||
'plugin:@typescript-eslint/eslint-recommended', | ||
'plugin:@typescript-eslint/recommended' | ||
] | ||
} | ||
], | ||
settings: { | ||
react: { | ||
createClass: 'createReactClass', // Regex for Component Factory to use, | ||
// default to "createReactClass" | ||
pragma: 'React', // Pragma to use, default to "React" | ||
fragment: 'Fragment', // Fragment to use (may be a property of <pragma>), default to "Fragment" | ||
version: 'detect' // React version. "detect" automatically picks the version you have installed. | ||
} | ||
} | ||
}; |
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,5 @@ | ||
#!/usr/bin/env sh | ||
. "$(dirname -- "$0")/_/husky.sh" | ||
|
||
npx lint-staged | ||
|
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,19 @@ | ||
module.exports = { | ||
printWidth: 100, | ||
useTabs: false, | ||
tabWidth: 2, | ||
semi: true, | ||
singleQuote: true, | ||
// bracketSpacing: false, | ||
trailingComma: 'none', | ||
arrowParens: 'always', | ||
embeddedLanguageFormatting: 'auto', | ||
insertPragma: false, | ||
proseWrap: 'preserve', | ||
quoteProps: 'as-needed', | ||
requirePragma: false, | ||
rangeStart: 0, | ||
endOfLine: 'auto', | ||
jsxBracketSameLine: false, | ||
jsxSingleQuote: false, | ||
}; |
This file was deleted.
Oops, something went wrong.
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
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
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
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
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
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
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
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
Oops, something went wrong.