Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions workspaces/frontend/.eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ module.exports = {
'no-relative-import-paths',
'prettier',
'local-rules',
'@cspell',
],
extends: [
'eslint:recommended',
Expand Down Expand Up @@ -233,6 +234,10 @@ module.exports = {
'func-names': 'warn',
'local-rules/no-react-hook-namespace': 'error',
'local-rules/no-raw-react-router-hook': 'error',
'@cspell/spellchecker': [
'error',
{ configFile: 'config/cspell.json', customWordListFile: 'config/cspell-ignore-words.txt' },
],
},
overrides: [
{
Expand Down
8 changes: 8 additions & 0 deletions workspaces/frontend/config/cspell-ignore-words.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
scipy
kubeflow
mochawesome
jovyan
millicores
workspacekind
workspacekinds
healthcheck
51 changes: 51 additions & 0 deletions workspaces/frontend/config/cspell.config.cjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
/*
* Workaround suggested in https://github.com/streetsidesoftware/cspell/issues/3215
* while the fix for the library is in progress
*/

const fs = require('fs');
const path = require('path');

/**
* Search for `package.json`
* @param {string} from - search `from` directory.
* @returns {string} - path to package.json
*/
function findNearestPackageJson(from) {
from = path.resolve(from);
const parent = path.dirname(from);
if (!from || parent === from) {
return;
}

const pkg = path.join(from, 'package.json');
if (fs.existsSync(pkg)) {
return pkg;
}
return findNearestPackageJson(parent);
}

/**
* Load the nearest package.json
* @param {string} cwd
* @returns
*/
function loadPackage(cwd) {
const pkgFile = findNearestPackageJson(cwd);
if (!pkgFile) return;
return JSON.parse(fs.readFileSync(pkgFile, 'utf-8'));
}

function determinePackageNamesAndMethods(cwd = process.cwd()) {
const pkg = loadPackage(cwd) || {};
const packageNames = Object.keys(pkg.dependencies || {}).concat(
Object.keys(pkg.devDependencies || {}),
);
const setOfWords = new Set(packageNames.flatMap((name) => name.replace(/[@]/g, '').split('/')));
const words = [...setOfWords];
return { words };
}

module.exports = {
words: determinePackageNamesAndMethods().words,
};
3 changes: 3 additions & 0 deletions workspaces/frontend/config/cspell.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"import": ["./cspell.config.cjs"]
}
Loading