Skip to content

Commit

Permalink
eslint: add invenio eslint rules
Browse files Browse the repository at this point in the history
  • Loading branch information
nico authored and kpsherva committed Jul 29, 2022
1 parent 3e5e143 commit af69a46
Show file tree
Hide file tree
Showing 126 changed files with 15,192 additions and 17,319 deletions.
20 changes: 20 additions & 0 deletions .eslintrc.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
extends:
- '@inveniosoftware/eslint-config-invenio'
- '@inveniosoftware/eslint-config-invenio/prettier'

parser: '@babel/eslint-parser'

parserOptions:
sourceType: module
allowImportExportEverywhere: true
requireConfigFile: false
babelOptions:
presets:
- "@babel/preset-react"


env:
browser: true
es6: true
jest: true
node: true
3 changes: 3 additions & 0 deletions .github/workflows/node.js.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,9 @@ jobs:
run: |
npm install
npm run build
- name: Lint
run: npm run lint

- name: Test
run: npm test
5 changes: 1 addition & 4 deletions .prettierrc
Original file line number Diff line number Diff line change
@@ -1,4 +1 @@
{
"singleQuote": true,
"trailingComma": "es5"
}
"@inveniosoftware/eslint-config-invenio/prettier-config.js"
24 changes: 12 additions & 12 deletions i18next-scanner.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,14 @@
// React-Invenio-Deposit is free software; you can redistribute it and/or modify it
// under the terms of the MIT License; see LICENSE file for more details.

const { languages } = require('./package').config;
const { languages } = require("./package").config;

// list of func used to
// mark the strings for translation
const funcList = ['i18next.t'];
const funcList = ["i18next.t"];

// list of extension to look for
const extensions = ['.js', '.jsx'];
const extensions = [".js", ".jsx"];

module.exports = {
options: {
Expand All @@ -24,7 +24,7 @@ module.exports = {
},
//using Trans component
trans: {
component: 'Trans',
component: "Trans",
extensions: extensions,
fallbackKey: function (ns, value) {
return value;
Expand All @@ -33,30 +33,30 @@ module.exports = {
lngs: languages,
ns: [
// file name (.json)
'translations',
"translations",
],
defaultLng: 'en',
defaultNs: 'translations',
defaultLng: "en",
defaultNs: "translations",
// @param {string} lng The language currently used.
// @param {string} ns The namespace currently used.
// @param {string} key The translation key.
// @return {string} Returns a default value for the translation key.
defaultValue: function (lng, ns, key) {
if (lng === 'en') {
if (lng === "en") {
// Return key as the default value for English language
return key;
}
return '';
return "";
},
resource: {
// The path where resources get loaded from. Relative to current working directory.
loadPath: 'src/lib/translations/messages/{{lng}}/{{ns}}.json',
loadPath: "src/lib/translations/messages/{{lng}}/{{ns}}.json",

// The path to store resources.
savePath: 'src/lib/translations/messages/{{lng}}/{{ns}}.json',
savePath: "src/lib/translations/messages/{{lng}}/{{ns}}.json",

jsonIndent: 2,
lineEnding: '\n',
lineEnding: "\n",
},
nsSeparator: false, // namespace separator

Expand Down
Loading

0 comments on commit af69a46

Please sign in to comment.