Skip to content

Commit

Permalink
chore: improve husky prettier config (#878)
Browse files Browse the repository at this point in the history
* chore: improve husky, prettier, eslint config

* chore: update tests & format scripts

* chore: fix eslint config to handle classes correctly

* chore: format all with new prettier rules

* chore: update lint config

* fix: props & test

* chore: remove unused deps & update test script
  • Loading branch information
QRuhier authored Dec 2, 2024
1 parent 8359c1b commit 7b01ad0
Show file tree
Hide file tree
Showing 389 changed files with 4,664 additions and 2,894 deletions.
12 changes: 0 additions & 12 deletions .editorconfig

This file was deleted.

3 changes: 0 additions & 3 deletions .eslintignore

This file was deleted.

84 changes: 0 additions & 84 deletions .eslintrc.yaml

This file was deleted.

1 change: 0 additions & 1 deletion .github/ISSUE_TEMPLATE/bug_report.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ about: Create a report to help us improve
title: ''
labels: bug
assignees: ''

---

## Describe the bug
Expand Down
1 change: 0 additions & 1 deletion .github/ISSUE_TEMPLATE/feature_request.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ about: Suggest an idea for this project
title: ''
labels: enhancement
assignees: ''

---

## Feature Description
Expand Down
1 change: 1 addition & 0 deletions .husky/pre-commit
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
yarn lint-staged
1 change: 0 additions & 1 deletion .husky/pre-push

This file was deleted.

1 change: 1 addition & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
docs/
8 changes: 8 additions & 0 deletions .prettierrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"semi": true,
"singleQuote": true,
"plugins": ["@trivago/prettier-plugin-sort-imports"],
"importOrder": ["^react$", "<THIRD_PARTY_MODULES>", "^@/(.*)$", "^[./]"],
"importOrderSeparation": true,
"importOrderSortSpecifiers": true
}
4 changes: 2 additions & 2 deletions e2e/create-question.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ const genericInput = require('./po/generic-input');
const editQuestion = require('./po/edit-question');

module.exports = {
'Should close the model if Cancel is clicked': browser => {
'Should close the model if Cancel is clicked': (browser) => {
// PLEASE MAKE YOUR TESTS DATA AGNOSTICS
// browser
// .url(`${browser.globals.launch_url}/#/questionnaire/fr.insee-POPO-QPO-DOC`)
Expand All @@ -13,7 +13,7 @@ module.exports = {
// .waitForElementNotPresent(editQuestion.Tabs)
// .end()
},
'Should show declaration panel': browser => {
'Should show declaration panel': (browser) => {
// PLEASE MAKE YOUR TESTS DATA AGNOSTICS
// browser
// .url(`${browser.globals.launch_url}/#/questionnaire/fr.insee-POPO-QPO-DOC`)
Expand Down
4 changes: 2 additions & 2 deletions e2e/simpleTest.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
module.exports = {
'Application assert Title': browser => {
'Application assert Title': (browser) => {
browser
.url(browser.globals.launch_url)
.waitForElementVisible('body')
.assert.title('Pogues')
.end();
},
'Home page fetch wip questionnaires': browser => {
'Home page fetch wip questionnaires': (browser) => {
browser
.url(browser.globals.launch_url)
.waitForElementVisible('.home-questionnaires')
Expand Down
2 changes: 1 addition & 1 deletion e2e/update-questionnaire.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
const questionnairePage = require('./po/questionnaire');

module.exports = {
'Should update the title of a questionnaire': browser => {
'Should update the title of a questionnaire': (browser) => {
// PLEASE MAKE YOUR TESTS DATA AGNOSTICS
// browser
// .url(`${browser.globals.launch_url}/#/questionnaire/fr.insee-POPO-QPO-DOC`)
Expand Down
51 changes: 51 additions & 0 deletions eslint.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
import babelParser from '@babel/eslint-parser';
import js from '@eslint/js';
import react from 'eslint-plugin-react';
import reactHooks from 'eslint-plugin-react-hooks';
import reactRefresh from 'eslint-plugin-react-refresh';
import globals from 'globals';

export default [
js.configs.recommended,
{
ignores: [
'dist',
'src/js/utils/draft-js/get-entity-at-cursor.js',
'src/forms/controls/rich-textarea/lib/markdown-vtl-parser.js',
'src/forms/controls/control-with-suggestions/components/vtl-suggestions.js',
'e2e',
'jison',
'vite.config.js',
'docs',
],
},
{
files: ['**/*.{js,jsx}'],
languageOptions: {
ecmaVersion: 2020,
globals: globals.browser,
sourceType: 'module',
parser: babelParser,
parserOptions: {
ecmaFeatures: {
jsx: true,
},
requireConfigFile: false,
babelOptions: {
plugins: ['@babel/plugin-syntax-jsx'], // Add plugin for JSX support
},
},
},
plugins: {
react,
'react-hooks': reactHooks,
'react-refresh': reactRefresh,
},
rules: {
...reactHooks.configs.recommended.rules,
'react/jsx-uses-react': 'error',
'react/jsx-uses-vars': 'error',
'react-refresh/only-export-components': ['off'],
},
},
];
2 changes: 1 addition & 1 deletion index.html
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<!DOCTYPE html>
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8" />
Expand Down
Loading

0 comments on commit 7b01ad0

Please sign in to comment.