Skip to content

Commit

Permalink
Merge pull request #3073 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 2482456 + 5e2ce9b commit 719b4b0
Show file tree
Hide file tree
Showing 10 changed files with 7,360 additions and 13,275 deletions.
136 changes: 136 additions & 0 deletions .eslintrc.cjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,136 @@
module.exports = {
env: {
browser: true,
es2024: true,
},
extends: [
'standard',
'plugin:react/recommended',
'airbnb',
'plugin:prettier/recommended',
'plugin:cypress/recommended',
],
parserOptions: {
ecmaFeatures: {
jsx: true,
},
ecmaVersion: 'latest',
sourceType: 'module',
},
plugins: ['jsx-a11y', 'import', 'react', 'prettier'],
rules: {
'function-paren-newline': ['error', 'consistent'],
'comma-dangle': [
'error',
{
arrays: 'always-multiline',
objects: 'always-multiline',
imports: 'always-multiline',
exports: 'always-multiline',
functions: 'always-multiline',
},
],
indent: [
'error',
2,
{
SwitchCase: 1,
VariableDeclarator: 1,
outerIIFEBody: 1,
// MemberExpression: null,
FunctionDeclaration: {
parameters: 1,
body: 1,
},
FunctionExpression: {
parameters: 1,
body: 1,
},
CallExpression: {
arguments: 1,
},
ArrayExpression: 1,
ObjectExpression: 1,
ImportDeclaration: 1,
flatTernaryExpressions: false,
// list derived from https://github.com/benjamn/ast-types/blob/HEAD/def/jsx.js
ignoredNodes: [
'JSXElement',
'JSXElement > *',
'JSXAttribute',
'JSXIdentifier',
'JSXNamespacedName',
'JSXMemberExpression',
'JSXSpreadAttribute',
'JSXExpressionContainer',
'JSXOpeningElement',
'JSXClosingElement',
'JSXFragment',
'JSXOpeningFragment',
'JSXClosingFragment',
'JSXText',
'JSXEmptyExpression',
'JSXSpreadChild',
],
ignoreComments: false,
},
],
'no-unused-expressions': [
'error',
{
allowShortCircuit: false,
allowTernary: false,
allowTaggedTemplates: false,
},
],
'jsx-a11y/label-has-for': [
2,
{
components: ['Label'],
required: {
some: ['id', 'nesting'],
},
allowChildren: true,
},
],
'jsx-a11y/label-has-associated-control': [2, { assert: 'either' }],
'jsx-a11y/control-has-associated-label': 'off',
'implicit-arrow-linebreak': 0,
'import/prefer-default-export': 0,
'import/no-extraneous-dependencies': [
'error',
{
devDependencies: true,
optionalDependencies: false,
peerDependencies: false,
},
],
'max-len': [
'error',
{
ignoreTemplateLiterals: true,
ignoreComments: true,
},
],
'no-console': 'error',
'no-param-reassign': [2, { props: true }],
'no-shadow': ['error', { builtinGlobals: false }],
'padding-line-between-statements': [
'error',
{ 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: '*' },
],
'react/jsx-filename-extension': [1, { extensions: ['.js', '.jsx'] }],
'react/prop-types': 0,
'react/react-in-jsx-scope': 0,
'react/destructuring-assignment': 0,
'react/function-component-definition': 0,
},
};
4 changes: 0 additions & 4 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
3 changes: 2 additions & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,15 @@ jobs:

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

steps:
- uses: actions/checkout@v2
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v1
with:
node-version: ${{ matrix.node-version }}
- run: rm -rf node_modules package-lock.json
- run: npm install
- run: npm test -- -l
- name: Upload tests report(cypress mochaawesome merged HTML report)
Expand Down
4 changes: 2 additions & 2 deletions cypress.config.js
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 Decompose</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.jsx"></script>
</body>
</html>
Loading

0 comments on commit 719b4b0

Please sign in to comment.