Skip to content

Commit

Permalink
Fix linting (#12)
Browse files Browse the repository at this point in the history
* * add .editorconfig
* fix linting, extend from pixi eslint config and add react linter
* fix TS configuration
* install prettier
* add automatic react transform

* apply linting/prettier to codebase

* tweak things

* add nvmrc

* add husky lint-staged

* update PR GH actions

* fix type checking and remove unnecessary React imports / disabled eslint rules

* ignore eslint cache

* remove prettier:check as it doesn't like the final eslint rules

* switch back to 125 length and 4 indent

---------

Co-authored-by: Alex Prokop <[email protected]>
  • Loading branch information
baseten and Alex Prokop authored Mar 15, 2023
1 parent 875535c commit 3e17656
Show file tree
Hide file tree
Showing 81 changed files with 33,499 additions and 32,534 deletions.
10 changes: 10 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# This file is for unifying the coding style for different editors and IDEs.
# More information at http://EditorConfig.org
root = true

[*]
end_of_line = lf
insert_final_newline = true
trim_trailing_whitespace = true
indent_style = space
indent_size = 2
31 changes: 31 additions & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
module.exports = {
root: true,
extends: ['@pixi/eslint-config', 'plugin:react/recommended', 'plugin:react/jsx-runtime'],
parserOptions: {
project: ['tsconfig.eslint.json'],
tsconfigRootDir: __dirname,
},
settings: {
jsdoc: {
mode: 'typescript',
tagNamePreference: {
method: 'method',
function: 'function',
extends: 'extends',
typeParam: 'typeParam',
api: 'api',
},
},
},
ignorePatterns: ['build', 'node_modules'],
rules: {
'no-empty-function': 0,
'no-prototype-builtins': 0,
'spaced-comment': [1, 'always', { markers: ['/'] }],
'@typescript-eslint/triple-slash-reference': [1, { path: 'always' }],
'@typescript-eslint/consistent-type-imports': [1, { disallowTypeAnnotations: false }],
'@typescript-eslint/no-parameter-properties': 1,
'@typescript-eslint/type-annotation-spacing': 1,
'@typescript-eslint/ban-ts-comment': ['error', { 'ts-ignore': 'allow-with-description' }],
},
};
9 changes: 0 additions & 9 deletions .eslintrc.json

This file was deleted.

2 changes: 1 addition & 1 deletion .github/workflows/pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ jobs:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: '16'
node-version: '18'
cache: 'npm'
- run: npm ci
- run: npm run types
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -20,3 +20,4 @@ yarn-debug.log*
yarn-error.log*
.vscode
.idea
.eslintcache
4 changes: 4 additions & 0 deletions .husky/pre-commit
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/usr/bin/env sh
. "$(dirname -- "$0")/_/husky.sh"

npx lint-staged
1 change: 1 addition & 0 deletions .nvmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
v18
12 changes: 12 additions & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
**/.docusaurus
**/.git
**/.github
**/.idea
**/node_modules
*.frag
*.vert
/build

# TODO: just temporarily ignore these
/blog
/docs
7 changes: 7 additions & 0 deletions .prettierrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"singleQuote": true,
"trailingComma": "all",
"useTabs": false,
"tabWidth": 4,
"printWidth": 125
}
12 changes: 10 additions & 2 deletions babel.config.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,11 @@
module.exports = {
presets: [require.resolve('@docusaurus/core/lib/babel/preset')]
}
presets: [
require.resolve('@docusaurus/core/lib/babel/preset'),
[
require.resolve('@babel/preset-react'),
{
runtime: 'automatic',
},
],
],
};
Loading

0 comments on commit 3e17656

Please sign in to comment.