Skip to content

Commit

Permalink
Merge pull request #955 from mate-academy/vite-infra
Browse files Browse the repository at this point in the history
add Vite
  • Loading branch information
mgrinko authored Sep 2, 2024
2 parents 3098a35 + 74da205 commit 474ae79
Show file tree
Hide file tree
Showing 11 changed files with 8,061 additions and 13,375 deletions.
108 changes: 108 additions & 0 deletions .eslintrc.cjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,108 @@
module.exports = {
env: {
browser: true,
es2024: true,
},
extends: [
'plugin:react/recommended',
"plugin:react-hooks/recommended",
'airbnb-typescript',
'plugin:@typescript-eslint/eslint-recommended',
'plugin:@typescript-eslint/recommended',
'plugin:prettier/recommended',
'plugin:cypress/recommended',
],
overrides: [
{
'files': ['**/*.spec.jsx'],
'rules': {
'react/jsx-filename-extension': ['off'],
}
}
],
parser: '@typescript-eslint/parser',
parserOptions: {
ecmaFeatures: {
jsx: true,
},
ecmaVersion: 12,
project: './tsconfig.json',
sourceType: 'module',
},
plugins: [
'jsx-a11y',
'import',
'react-hooks',
'@typescript-eslint',
'prettier'
],
rules: {
// JS
'semi': 'off',
'@typescript-eslint/semi': ['error', 'always'],
'prefer-const': 2,
curly: [2, 'all'],
'max-len': ['error', {
ignoreTemplateLiterals: true,
ignoreComments: true,
}],
'no-redeclare': [2, { builtinGlobals: true }],
'no-console': 2,
'operator-linebreak': 0,
'brace-style': [2, '1tbs'],
'arrow-body-style': 0,
'arrow-parens': 0,
'no-param-reassign': [2, { props: true }],
'padding-line-between-statements': [
2,
{ blankLine: 'always', prev: '*', next: 'return' },
{ blankLine: 'always', prev: ['const', 'let', 'var'], next: '*' },
{ blankLine: 'any', prev: ['const', 'let', 'var'], next: ['const', 'let', 'var'] },
{ blankLine: 'always', prev: 'directive', next: '*' },
{ blankLine: 'always', prev: 'block-like', next: '*' },
],
'implicit-arrow-linebreak:': 0,

// React
'react/prop-types': 0,
'react/require-default-props': 0,
'import/prefer-default-export': 0,
'standard/no-callback-literal': 0,
'react/jsx-filename-extension': [1, { extensions: ['.tsx'] }],
'react/destructuring-assignment': 0,
'react/jsx-props-no-spreading': 0,
'react/state-in-constructor': [2, 'never'],
'react-hooks/rules-of-hooks': 2,
'jsx-a11y/label-has-associated-control': ["error", {
assert: "either",
}],
'jsx-a11y/label-has-for': [2, {
components: ['Label'],
required: {
some: ['id', 'nesting'],
},
allowChildren: true,
}],
'react/jsx-uses-react': 'off',
'react/react-in-jsx-scope': 'off',

// Typescript
'@typescript-eslint/explicit-function-return-type': 'off',
'@typescript-eslint/explicit-module-boundary-types': 'off',
'@typescript-eslint/no-unused-vars': ['error'],
'@typescript-eslint/indent': ['error', 2],
'@typescript-eslint/ban-types': ['error', {
extendDefaults: true,
types: {
'{}': false,
},
},
],
},
ignorePatterns: ['dist', '.eslintrc.cjs', 'vite.config.ts', 'src/vite-env.d.ts', 'cypress'],
settings: {
react: {
version: 'detect',
},
},
};
7 changes: 0 additions & 7 deletions .eslintrc.js

This file was deleted.

2 changes: 1 addition & 1 deletion .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ jobs:

strategy:
matrix:
node-version: [14.x]
node-version: [20.x]

steps:
- uses: actions/checkout@v2
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ jobs:

strategy:
matrix:
node-version: [14.x]
node-version: [20.x]

steps:
- uses: actions/checkout@v2
Expand Down
4 changes: 2 additions & 2 deletions cypress.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@ module.exports = defineConfig({
component: {
specPattern: 'src/**/*.spec.{js,ts,jsx,tsx}',
devServer: {
framework: 'create-react-app',
bundler: 'webpack',
framework: 'react',
bundler: 'vite',
},
},
});
9 changes: 5 additions & 4 deletions public/index.html → index.html
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
<!DOCTYPE html>
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<title>React Redux list of Todos</title>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Vite + React + TS</title>
</head>
<body>
<div id="root"></div>
<script type="module" src="/src/index.tsx"></script>
</body>
</html>
Loading

0 comments on commit 474ae79

Please sign in to comment.