Skip to content
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

style: add additional style rules & apply fixes #75

Merged
merged 25 commits into from
Apr 4, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
1d098f9
style: add `object-shorthand` rule & apply fixes
devonzara Apr 1, 2023
69201da
chore: update ts-eslint plugin & parser
devonzara Apr 2, 2023
9547350
style: add ts-eslint `key-spacing` rule & apply fixes
devonzara Apr 2, 2023
50ae0df
style: add ts-eslint `space-before-blocks` rule
devonzara Apr 2, 2023
510969d
style: add `arrow-spacing` rule
devonzara Apr 2, 2023
6e7ad52
style: add `arrow-parens` rule & apply fixes
devonzara Apr 2, 2023
4b009df
style: add ts-eslint `brace-style` rule
devonzara Apr 2, 2023
fc0f03a
style: add ts-eslint `member-delimiter-style` rule
devonzara Apr 2, 2023
50b4cef
style: add `array-bracket-newline` rule
devonzara Apr 2, 2023
d0a522e
style: add `object-curly-newline` rule
devonzara Apr 2, 2023
304c42e
style: add `padded-blocks` rule & apply fixes
devonzara Apr 2, 2023
02898f1
style: add `eslint-plugin-import/exports-last` rule & apply fixes
devonzara Apr 2, 2023
2406322
style: add ts-eslint `indent` rule
devonzara Apr 2, 2023
3154ea0
style: add `'no-unused-vars': 'off'` as per ts-eslint docs
devonzara Apr 2, 2023
a20ad0c
style: switch to ts-eslint's `semi` rule & apply fixes
devonzara Apr 2, 2023
6139fa9
style: organize eslintrc
devonzara Apr 2, 2023
c976eb7
style: add `padding-line-between-statements` rule for directives
devonzara Apr 2, 2023
3c2f693
style: remove ignores/overrides and apply style fixes
devonzara Apr 2, 2023
0d99d21
style: add ts-eslint `keyword-spacing` rule
devonzara Apr 4, 2023
a7074f6
style: add ts-eslint `space-infix-ops` rule
devonzara Apr 4, 2023
5f7f553
style: switch to ts-eslint `object-curly-spacing` & apply fixes
devonzara Apr 4, 2023
41949fc
style: switch to ts-eslint `comma-dangle`
devonzara Apr 4, 2023
0231dcd
style: switch to ts-eslint `padding-line-between-statements`
devonzara Apr 4, 2023
7639c06
Merge branch 'main'
devonzara Apr 4, 2023
c886081
style: apply style fixes
devonzara Apr 4, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
62 changes: 47 additions & 15 deletions .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,28 +6,52 @@ module.exports = {
],
parser: '@typescript-eslint/parser',
plugins: ['@typescript-eslint'],
ignorePatterns: ['.github', 'server/migrations', 'dist'],
ignorePatterns: ['.github', 'dist'],
root: true,
env: {
node: true,
},
rules: {
// Disable base rules to avoid @typescript-eslint conflicts
'brace-style': 'off',
'comma-dangle': 'off',
indent: 'off',
'key-spacing': 'off',
'keyword-spacing': 'off',
'no-unused-vars': 'off',
'object-curly-spacing': 'off',
'padding-line-between-statements': 'off',
semi: 'off',
'space-before-blocks': 'off',
'space-infix-ops': 'off',

// Basic rules
indent: ['error', 2, { SwitchCase: 1 }],
// `ts-lint: indent` has known issues, we can remove if it becomes a problem...
// https://github.com/typescript-eslint/typescript-eslint/issues/1824
'@typescript-eslint/indent': ['error', 2, {
SwitchCase: 1,
flatTernaryExpressions: false,
ignoredNodes: [
'PropertyDefinition[decorators]',
'TSUnionType',
'FunctionExpression[params]:has(Identifier[decorators])',
],
}],
'max-len': ['warn', 120],
'@typescript-eslint/no-unused-vars': 'error',
'prefer-const': 'error',
semi: ['error', 'always'],
'@typescript-eslint/semi': 'error',

// Quote rules
quotes: ['error', 'single'],
'quote-props': ['error', 'as-needed'],

// TypeScript rules
'@typescript-eslint/member-delimiter-style': 'error',
'@typescript-eslint/no-explicit-any': 'error',
'@typescript-eslint/no-unused-vars': 'error',

// Comma rules
'comma-dangle': ['error', 'always-multiline'],
'@typescript-eslint/comma-dangle': ['error', 'always-multiline'],
'comma-spacing': 'error',
'comma-style': ['error', 'last'],

Expand All @@ -36,19 +60,34 @@ module.exports = {
'no-multiple-empty-lines': ['error', { max: 1, maxEOF: 1 }],
'no-trailing-spaces': 'error',

// Keyword/operator spacing rules
'@typescript-eslint/keyword-spacing': 'error',
'@typescript-eslint/space-infix-ops': 'error',

// Brace/parenthesis spacing rules
'array-bracket-spacing': ['error', 'never'],
'object-curly-spacing': ['error', 'always', { objectsInObjects: false }],
'array-bracket-newline': ['error', 'consistent'],
'arrow-parens': ['error', 'as-needed'],
'arrow-spacing': 'error',
'@typescript-eslint/brace-style': 'error',
'@typescript-eslint/key-spacing': 'error',
'object-curly-newline': ['error', { consistent: true }],
'@typescript-eslint/object-curly-spacing': ['error', 'always', { objectsInObjects: false }],
'object-shorthand': ['error', 'always', { avoidQuotes: true }],
'padded-blocks': ['error', 'never'],
'@typescript-eslint/space-before-blocks': 'error',
'space-in-parens': ['error', 'never'],

// Newline padding rules
'padding-line-between-statements': [
'@typescript-eslint/padding-line-between-statements': [
'error',
{ blankLine: 'always', prev: '*', next: 'export' },
{ blankLine: 'any', prev: 'export', next: 'export' },
{ blankLine: 'always', prev: 'directive', next: '*' },
],

// Import rules
// Import/export rules
'import/exports-last': 'error',
'import/newline-after-import': 'error',
'import/order': ['error', {
groups: [
Expand All @@ -64,12 +103,6 @@ module.exports = {
alphabetize: { order: 'asc', caseInsensitive: true },
}],
},
overrides: [{
files: ['server/migrations/*.js'],
rules: {
'@typescript-eslint/no-unused-vars': 0,
},
}],
settings: {
'import/resolver': {
typescript: true,
Expand All @@ -80,4 +113,3 @@ module.exports = {
},
},
};

4 changes: 2 additions & 2 deletions cypress.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@ import { defineConfig } from 'cypress';
export default defineConfig({
e2e: {
supportFile: './cypress/support/e2e.ts',
specPattern:'./cypress/e2e',
specPattern: './cypress/e2e',
},
fixturesFolder: './cypress/fixtures',
screenshotsFolder: './cypress/screenshots',
videosFolder: './cypress/videos',
downloadsFolder: './cypress/downloads',
fileServerFolder:'./',
fileServerFolder: './',
});
2 changes: 1 addition & 1 deletion cypress/support/commands.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,4 +35,4 @@
// }
// }
// }
export = {}
export = {};