-
Notifications
You must be signed in to change notification settings - Fork 26
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: add eslinter, and run lint (#539)
* add eslinter, and run lint * add linter workflow
- Loading branch information
Showing
32 changed files
with
992 additions
and
474 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,45 @@ | ||
name: Lint Client | ||
|
||
on: | ||
push: | ||
branches: | ||
- main | ||
- release/* | ||
paths: | ||
- "clients/js/**" | ||
- ".github/workflows/lint-client.yml" | ||
pull_request: | ||
branches: | ||
- main | ||
paths: | ||
- "clients/js/**" | ||
- ".github/workflows/lint-client.yml" | ||
types: [opened, reopened] | ||
|
||
workflow_dispatch: | ||
|
||
jobs: | ||
starshipjs-tests: | ||
runs-on: ubuntu-latest | ||
|
||
defaults: | ||
run: | ||
working-directory: clients/js | ||
|
||
steps: | ||
- name: Checkout Repository 🛎️ | ||
uses: actions/checkout@v4 | ||
|
||
- name: Setup Node.js | ||
uses: actions/setup-node@v4 | ||
with: | ||
node-version: '20.x' | ||
|
||
- name: Install Dependencies | ||
run: yarn install | ||
|
||
- name: Build Project | ||
run: yarn build | ||
|
||
- name: Run lint | ||
run: yarn run lint |
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 |
---|---|---|
|
@@ -2,5 +2,5 @@ | |
"trailingComma": "es5", | ||
"tabWidth": 2, | ||
"semi": true, | ||
"singleQuote": false | ||
"singleQuote": 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
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,75 @@ | ||
module.exports = { | ||
parser: '@typescript-eslint/parser', // Specify the ESLint parser | ||
plugins: ['@typescript-eslint', 'prettier'], | ||
extends: [ | ||
'eslint:recommended', | ||
'plugin:@typescript-eslint/recommended', // Uses the recommended rules from the @typescript-eslint/eslint-plugin | ||
'plugin:prettier/recommended' | ||
], | ||
parserOptions: { | ||
ecmaVersion: 2020, // Allows for the parsing of modern ECMAScript features | ||
sourceType: 'module', // Allows for the use of imports | ||
ecmaFeatures: { | ||
jsx: true // Allows for the parsing of JSX | ||
} | ||
}, | ||
env: { | ||
es6: true, | ||
browser: true, | ||
node: true, | ||
jest: true | ||
}, | ||
rules: { | ||
'@typescript-eslint/no-explicit-any': 'off', // Disable the rule entirely | ||
'no-debugger': 2, | ||
'no-alert': 2, | ||
'no-await-in-loop': 0, | ||
'no-prototype-builtins': 0, | ||
'no-return-assign': ['error', 'except-parens'], | ||
'no-restricted-syntax': [ | ||
2, | ||
'ForInStatement', | ||
'LabeledStatement', | ||
'WithStatement' | ||
], | ||
'no-unused-vars': [ | ||
0, | ||
{ | ||
ignoreSiblings: true, | ||
argsIgnorePattern: 'React|res|next|^_' | ||
} | ||
], | ||
'prefer-const': [ | ||
'error', | ||
{ | ||
destructuring: 'all' | ||
} | ||
], | ||
'no-unused-expressions': [ | ||
2, | ||
{ | ||
allowTaggedTemplates: true | ||
} | ||
], | ||
'no-console': 'off', | ||
'comma-dangle': 2, | ||
'jsx-quotes': [2, 'prefer-double'], | ||
'linebreak-style': ['error', 'unix'], | ||
quotes: [ | ||
2, | ||
'single', | ||
{ | ||
avoidEscape: true, | ||
allowTemplateLiterals: true | ||
} | ||
], | ||
'prettier/prettier': [ | ||
'error', | ||
{ | ||
trailingComma: 'none', | ||
singleQuote: true, | ||
printWidth: 80 | ||
} | ||
] | ||
} | ||
}; |
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,18 @@ | ||
/** @type {import('ts-jest').JestConfigWithTsJest} */ | ||
module.exports = { | ||
preset: "ts-jest", | ||
testEnvironment: "node", | ||
transform: { | ||
"^.+\\.tsx?$": [ | ||
"ts-jest", | ||
{ | ||
babelConfig: false, | ||
tsconfig: "tsconfig.json", | ||
}, | ||
], | ||
}, | ||
transformIgnorePatterns: [`/node_modules/*`], | ||
testRegex: "(/__tests__/.*|(\\.|/)(test|spec))\\.(jsx?|tsx?)$", | ||
moduleFileExtensions: ["ts", "tsx", "js", "jsx", "json", "node"], | ||
modulePathIgnorePatterns: ["dist/*"] | ||
preset: 'ts-jest', | ||
testEnvironment: 'node', | ||
transform: { | ||
'^.+\\.tsx?$': [ | ||
'ts-jest', | ||
{ | ||
babelConfig: false, | ||
tsconfig: 'tsconfig.json' | ||
} | ||
] | ||
}, | ||
transformIgnorePatterns: [`/node_modules/*`], | ||
testRegex: '(/__tests__/.*|(\\.|/)(test|spec))\\.(jsx?|tsx?)$', | ||
moduleFileExtensions: ['ts', 'tsx', 'js', 'jsx', 'json', 'node'], | ||
modulePathIgnorePatterns: ['dist/*'] | ||
}; |
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.