Skip to content

Commit

Permalink
chore: update eslint and prettier, use arbnb rules as base for our ne…
Browse files Browse the repository at this point in the history
…w standart #patch (flyteorg#328)

* chore: update eslint and prettier, use arbnb rules as base for standart
* chore: prettier run through p.1 - p8
* chore: eslint shuffle imports
* chore: eslint set few rules to warn, so we can start working on them

Signed-off-by: Nastya Rusina <[email protected]>
  • Loading branch information
anrusina authored Mar 16, 2022
1 parent 3602c0a commit 5732fc1
Show file tree
Hide file tree
Showing 515 changed files with 29,059 additions and 32,062 deletions.
27 changes: 0 additions & 27 deletions .editorconfig

This file was deleted.

2 changes: 0 additions & 2 deletions .eslintignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,5 @@ src/generated/
.dist/
dist/
node_modules/
.vscode/
tsd/
package.json
webpack.config.ts
147 changes: 120 additions & 27 deletions .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,41 +2,134 @@ module.exports = {
root: true,
env: {
browser: true,
es6: true,
node: true
es2021: true,
},
parser: '@typescript-eslint/parser',
plugins: ['@typescript-eslint', 'react-hooks', 'jest'],
extends: [
'eslint:recommended',
'plugin:@typescript-eslint/recommended',
'plugin:react-hooks/recommended',
'plugin:jest/recommended',
'prettier',
'prettier/@typescript-eslint'
],
parserOptions: {
ecmaFeatures: {
jsx: true,
},
ecmaVersion: 'latest',
sourceType: 'module',
},
extends: ['plugin:react/recommended', 'airbnb', 'prettier'],
plugins: ['react', '@typescript-eslint'],
settings: {
'import/resolver': {
node: {
extensions: ['.js', '.jsx', '.ts', '.tsx'],
},
},
},
rules: {
// Rules we don't want to be enabled
'no-unused-vars': 'off', // disabled to let "@typescript-eslint/no-unused-vars" do it's job
'@typescript-eslint/no-unused-vars': ['warn', { argsIgnorePattern: '^_' }],
'jest/no-mocks-import': 'off',
// "off" or 0: turn off the rule completely; "warn" or 1; "error" or 2
'arrow-body-style': 'off',
'import/extensions': 'off',
'import/prefer-default-export': 'off',
'react/jsx-boolean-value': 'off',
'react/jsx-filename-extension': [2, { extensions: ['.jsx', '.tsx'] }],
'lines-between-class-members': ['error', 'always', { exceptAfterSingleLine: true }],

// up for discussion
'react/function-component-definition': 'off',
'react/destructuring-assignment': 'off',

/**
* temporarily off or warn
* */
// some setup of eslint or prettier needed
'no-undef': 'off', // 1066
'import/no-unresolved': 'off', // 1275
'import/no-extraneous-dependencies': 'off', // 715 - !important
'react/jsx-props-no-spreading': 'off', // 119

// temporarily disabled
'@typescript-eslint/no-var-requires': 'off', // 27
'@typescript-eslint/ban-types': 'warn', // 62
'@typescript-eslint/no-empty-function': 'warn', // 60
'@typescript-eslint/explicit-module-boundary-types': 'off', // 296
'@typescript-eslint/no-explicit-any': 'warn', // 118
'@typescript-eslint/no-non-null-assertion': 'warn', // 59
'react-hooks/exhaustive-deps': 'warn' // 24
// classic
'no-unused-vars': 'off', // 364
'no-use-before-define': 'warn', // 49
'no-shadow': 'off', // 104
'no-redeclare': 'warn', // 16
'no-param-reassign': 'off', // 28
'no-unused-expressions': 'warn', // 6
'prefer-destructuring': 'off', // 34
'max-classes-per-file': 'warn', // 2
'no-empty-function': 'off',
'no-useless-constructor': 'warn',
'no-useless-computed-key': 'off',
'no-restricted-syntax': 'off',
'no-else-return': 'off',
'no-console': 'warn',
'no-plusplus': 'off',
'no-var': 'off',
'no-continue': 'off',
'no-unsafe-optional-chaining': 'off',
'no-throw-literal': 'off',
'no-lonely-if': 'off',
'no-useless-return': 'off',
'no-return-await': 'off',
'no-nested-ternary': 'off',
'no-restricted-globals': 'off',
'no-return-assign': 'off',
'no-await-in-loop': 'off',
'no-undef-init': 'off',
'no-unneeded-ternary': 'off',
'prefer-object-spread': 'off',
'prefer-template': 'off',
'default-case': 'off',
'valid-typeof': 'off',
'object-shorthand': 'off',
'operator-assignment': 'off',
'array-callback-return': 'off',
'global-require': 'off',
'dot-notation': 'off',
'guard-for-in': 'off',
'one-var': 'off',
'vars-on-top': 'off',
'consistent-return': 'off',
'prefer-promise-reject-errors': 'off',
'prefer-arrow-callback': 'off',
'func-names': 'off',
eqeqeq: 'warn',
camelcase: 'warn',

// import
'import/no-dynamic-require': 'warn', // 1

// react
'react/button-has-type': 'off', // 5
'react/jsx-no-useless-fragment': 'off', // 15
'react/no-access-state-in-setstate': 'warn', // 2
'react/jsx-no-bind': 'warn', // 3
'react/prop-types': 'off',
'react/jsx-curly-brace-presence': 'off',
'react/self-closing-comp': 'off',
'react/jsx-no-constructed-context-values': 'off',
'react/no-unstable-nested-components': 'off',
'react/no-unescaped-entities': 'off',
'react/require-default-props': 'off',
'react/no-unused-prop-types': 'off',
'react/no-array-index-key': 'off',
'react/no-unused-state': 'off',
'react/static-property-placement': 'off',
'react/state-in-constructor': 'off',
'react/no-children-prop': 'off',
'react/sort-comp': 'off',

// jsx-a11y
'jsx-a11y/aria-role': 'off',
'jsx-a11y/anchor-is-valid': 'off',
'jsx-a11y/click-events-have-key-events': 'off',
'jsx-a11y/no-noninteractive-element-interactions': 'off',
'jsx-a11y/no-static-element-interactions': 'off',
'jsx-a11y/control-has-associated-label': 'off',
},
overrides: [
{
// overrides for test files
files: ['*.spec.*', '*.test.*', 'src/**/test/*'],
rules: {
'@typescript-eslint/no-explicit-any': 'off'
}
}
]
'@typescript-eslint/no-explicit-any': 'off',
'import/no-extraneous-dependencies': 'off',
},
},
],
};
7 changes: 0 additions & 7 deletions .prettierignore

This file was deleted.

6 changes: 3 additions & 3 deletions .prettierrc.yml
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
singleQuote: true
tabWidth: 4
max-line-length: 120
printWidth: 120
printWidth: 100
trailingComma: "all"
overrides:
- files: ["*.js*", "*.ts*", "*.json"]
- files: ["*.js", "*.jsx", "*.ts", "*.tsx"]
options:
tabWidth: 2
- files: ["*.yml", "*.yaml"]
Expand Down
36 changes: 18 additions & 18 deletions .releaserc.json
Original file line number Diff line number Diff line change
@@ -1,21 +1,21 @@
{
"plugins": [
"@semantic-release/commit-analyzer",
"@semantic-release/release-notes-generator",
[
"@semantic-release/changelog",
{
"changelogTitle": "# Changelog\n\nAll notable changes to this project will be documented in this file. See\n[Conventional Commits](https://conventionalcommits.org) for commit guidelines."
}
],
["@semantic-release/npm", { "npmPublish": false }],
"@semantic-release/github",
[
"@semantic-release/git",
{
"assets": ["package.json", "CHANGELOG.md"],
"message": "chore(release): Release ${nextRelease.version} [skip ci]\n\n${nextRelease.notes}"
}
"plugins": [
"@semantic-release/commit-analyzer",
"@semantic-release/release-notes-generator",
[
"@semantic-release/changelog",
{
"changelogTitle": "# Changelog\n\nAll notable changes to this project will be documented in this file. See\n[Conventional Commits](https://conventionalcommits.org) for commit guidelines."
}
],
["@semantic-release/npm", { "npmPublish": false }],
"@semantic-release/github",
[
"@semantic-release/git",
{
"assets": ["package.json", "CHANGELOG.md"],
"message": "chore(release): Release ${nextRelease.version} [skip ci]\n\n${nextRelease.notes}"
}
]
]
]
}
4 changes: 2 additions & 2 deletions .storybook/StorybookContainer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ import { muiTheme } from '../src/components/Theme/muiTheme';
const useStyles = makeStyles((theme: Theme) => ({
container: {
display: 'flex',
padding: theme.spacing(1)
}
padding: theme.spacing(1),
},
}));

export const StorybookContainer: React.FC = ({ children }) => {
Expand Down
14 changes: 9 additions & 5 deletions .storybook/main.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,13 @@
module.exports = {
core: {
builder: 'webpack5'
builder: 'webpack5',
},
stories: ['../src/**/*.stories.mdx', '../src/**/*.stories.@(js|jsx|ts|tsx)'],
addons: ['@storybook/addon-links', '@storybook/addon-essentials', '@storybook/addon-interactions'],
addons: [
'@storybook/addon-links',
'@storybook/addon-essentials',
'@storybook/addon-interactions',
],
framework: '@storybook/react',
webpackFinal: async (config, { configType }) => {
config.resolve.modules = ['src', 'node_modules'];
Expand All @@ -15,9 +19,9 @@ module.exports = {
// flyteidl.d.ts file.
test: /\.tsx?$/,
exclude: /node_modules/,
use: ['babel-loader', { loader: 'ts-loader', options: { transpileOnly: true } }]
}
use: ['babel-loader', { loader: 'ts-loader', options: { transpileOnly: true } }],
},
];
return config;
}
},
};
10 changes: 5 additions & 5 deletions .storybook/preview.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,15 @@ export const parameters = {
controls: {
matchers: {
color: /(background|color)$/i,
date: /Date$/
}
}
date: /Date$/,
},
},
};

export const decorators = [
Story => (
(Story) => (
<StorybookContainer>
<Story />
</StorybookContainer>
)
),
];
18 changes: 7 additions & 11 deletions .vscode/extensions.json
Original file line number Diff line number Diff line change
@@ -1,13 +1,9 @@
{
// See https://go.microsoft.com/fwlink/?LinkId=827846 to learn about workspace recommendations.
// Extension identifier format: ${publisher}.${name}. Example: vscode.csharp
// See https://go.microsoft.com/fwlink/?LinkId=827846 to learn about workspace recommendations.
// Extension identifier format: ${publisher}.${name}. Example: vscode.csharp

// List of extensions which should be recommended for users of this workspace.
"recommendations": [
"eamodio.gitlens"
],
// List of extensions recommended by VS Code that should not be recommended for users of this workspace.
"unwantedRecommendations": [

]
}
// List of extensions which should be recommended for users of this workspace.
"recommendations": ["eamodio.gitlens", "dbaeumer.vscode-eslint", "esbenp.prettier-vscode"],
// List of extensions recommended by VS Code that should not be recommended for users of this workspace.
"unwantedRecommendations": []
}
7 changes: 5 additions & 2 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -1,9 +1,12 @@
{
"[html]": {
"[html][json]": {
"editor.detectIndentation": false,
"editor.tabSize": 4
},
"[javascript][javascriptreact][typescript][typescriptreact]": {
"editor.detectIndentation": false,
"editor.tabSize": 2
},
}
"editor.defaultFormatter": "esbenp.prettier-vscode",
"editor.formatOnSave": true
}
8 changes: 3 additions & 5 deletions assetsTransformer.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
const path = require('path');

module.exports = {
process(_src, filename, _config, _options) {
return (
'module.exports = ' + JSON.stringify(path.basename(filename)) + ';'
);
}
process(_src, filename, _config, _options) {
return 'module.exports = ' + JSON.stringify(path.basename(filename)) + ';';
},
};
Loading

0 comments on commit 5732fc1

Please sign in to comment.