Skip to content

Commit

Permalink
Merge pull request #1194 from EcrituresNumeriques/feat/eslint-jsdoc
Browse files Browse the repository at this point in the history
  • Loading branch information
thom4parisot authored Jan 24, 2025
2 parents 0905576 + f53bb42 commit 00cd285
Show file tree
Hide file tree
Showing 10 changed files with 220 additions and 29 deletions.
9 changes: 8 additions & 1 deletion front/.eslintrc.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ module.exports = {
'eslint:recommended',
'plugin:react/recommended',
'plugin:jsonc/recommended-with-json',
'plugin:jsdoc/recommended-typescript-flavor',
],
parserOptions: {
ecmaFeatures: {
Expand All @@ -22,7 +23,7 @@ module.exports = {
parser: 'jsonc-eslint-parser',
},
],
plugins: ['react', 'vitest'],
plugins: ['react', 'vitest', 'jsdoc'],
settings: {
react: {
version: '16.13',
Expand All @@ -39,6 +40,12 @@ module.exports = {
__HUMANID_REGISTER_ENDPOINT__: true,
},
rules: {
'jsdoc/require-description': ['off'],
'jsdoc/require-example': ['off'],
'jsdoc/require-jsdoc': ['off'],
'jsdoc/require-param-description': ['off'],
'jsdoc/require-returns-description': ['off'],
'jsdoc/require-property-description': ['off'],
'react/prop-types': ['warn'],
'no-unused-vars': ['warn'],
'jsonc/indent': ['error', 2],
Expand Down
177 changes: 177 additions & 0 deletions front/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 3 additions & 2 deletions front/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -77,8 +77,8 @@
"yjs": "^13.6.6"
},
"optionalDependencies": {
"@rollup/rollup-linux-x64-gnu": "^4.31.0",
"@esbuild/linux-x64": "^0.24.2"
"@esbuild/linux-x64": "^0.24.2",
"@rollup/rollup-linux-x64-gnu": "^4.31.0"
},
"overrides": {
"@geist-ui/core": {
Expand All @@ -100,6 +100,7 @@
"@vitest/coverage-v8": "^3.0.3",
"@welldone-software/why-did-you-render": "~8.0",
"eslint": "^8.2.0",
"eslint-plugin-jsdoc": "^50.6.2",
"eslint-plugin-jsonc": "^2.5.0",
"eslint-plugin-react": "^7.27.0",
"eslint-plugin-vitest": "^0.5.4",
Expand Down
2 changes: 1 addition & 1 deletion front/src/components/SelectCombobox.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

/**
* @param {ComboboxItem[]} items
* @returns {Record<String, ComboboxItem[]>}
* @returns {Record<string, ComboboxItem[]>}
*/
export function groupItems(items) {
return Array.from(
Expand Down
2 changes: 1 addition & 1 deletion front/src/helpers/bibtex.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ export function toBibtex(entries) {
/**
* We tolerate `unexpected_field` warnings as it's user provided, it does not have any side effect
* @see https://github.com/EcrituresNumeriques/stylo/issues/187
*
* @param {string} bibtex
* @returns {Promise<{success: number,empty: boolean,warnings: Array.<string>,error: Array.<string>}>}
*/
Expand Down Expand Up @@ -88,6 +87,7 @@ export function deriveAuthorNameAndDate(entry) {

/**
* @param {string} Bibtex bibliography

Check warning on line 89 in front/src/helpers/bibtex.js

View workflow job for this annotation

GitHub Actions / build / build

Expected @param names to be "input". Got "Bibtex, input"
* @param input

Check warning on line 90 in front/src/helpers/bibtex.js

View workflow job for this annotation

GitHub Actions / build / build

Missing JSDoc @param "input" type
* @returns {Array.<{ title: string, key: string, type: string }}

Check warning on line 91 in front/src/helpers/bibtex.js

View workflow job for this annotation

GitHub Actions / build / build

Syntax error in type: Array.<{ title: string, key: string, type: string }
*/
export function toEntries(input) {
Expand Down
2 changes: 1 addition & 1 deletion front/src/helpers/forms.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
* Transforms a form into a plain object
*
* formData.entries() does not handle multiple values (sic) and formData.getAll() only works at a field level
*
* @param {React.ReactHTMLElement|FormData} formElement

Check warning on line 5 in front/src/helpers/forms.js

View workflow job for this annotation

GitHub Actions / build / build

Expected @param names to be "input". Got "formElement, input"
* @param input

Check warning on line 6 in front/src/helpers/forms.js

View workflow job for this annotation

GitHub Actions / build / build

Missing JSDoc @param "input" type
* @returns {Record<string, string|number|string[]|number[]>}
*/
export function fromFormData(input) {
Expand Down
2 changes: 1 addition & 1 deletion front/src/helpers/graphQL.js
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ export function useGraphQL() {
* @param {string} sessionToken
* @param {DocumentNode|string} queryOrAST
* @param {{[string: key]: value}} variables

Check warning on line 71 in front/src/helpers/graphQL.js

View workflow job for this annotation

GitHub Actions / build / build

@param "variables" does not match an existing function parameter
* @return {Promise<string|object>}
* @returns {Promise<string|object>}
*/
export function runQuery({ sessionToken }, { query: queryOrAST, variables }) {
const query = typeof queryOrAST === 'string' ? queryOrAST : print(queryOrAST)
Expand Down
4 changes: 2 additions & 2 deletions front/src/helpers/isidore.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
* Search a vocabulary from the Isidore API.
* Eg: https://api.isidore.science/vocabulary/suggest?q=quebe&output=json
* @param {string} searchValue
* @returns {Promise<Object>}
* @returns {Promise<object>}
*/
export async function searchKeyword(searchValue) {
if (searchValue && searchValue.length > 0) {
Expand Down Expand Up @@ -51,7 +51,7 @@ export async function searchKeyword(searchValue) {
* Search an author from the Isidore API.
* Eg: https://api.isidore.science/resource/suggest?q=marcell&feed=feed-creator&output=json
* @param {string} searchValue
* @returns {Promise<Object>}
* @returns {Promise<object>}
*/
export async function searchAuthor(searchValue) {
if (searchValue && searchValue.length > 0) {
Expand Down
Loading

0 comments on commit 00cd285

Please sign in to comment.