diff --git a/.eslintrc.js b/.eslintrc.js new file mode 100644 index 00000000..e45a61fd --- /dev/null +++ b/.eslintrc.js @@ -0,0 +1,95 @@ +/*///////////////////////////////// ABOUT \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*\ + + eslint configuration for MEME + updated 2024-06-18 + +\*\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\ * /////////////////////////////////////*/ + +/// CONFIG BLOCKS ///////////////////////////////////////////////////////////// +/// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +/** base eslint configuration */ +const CONFIG = { + 'env': { + 'browser': true, + 'commonjs': true, + 'es6': true, + 'node': true + }, + 'plugins': ['import', 'prettier', 'react'], + 'extends': ['airbnb', 'prettier'], + 'globals': { + 'PACKAGE_TITLE': 'readonly', // injected by webpack + 'PACKAGE_VERSION': 'readonly', // injected by webpack + 'PACKAGE_DESCRIPTION': 'readonly', // injected by webpack + '__static': 'readonly' // injected by webpack + }, + 'parserOptions': { + 'ecmaVersion': 2020, + 'ecmaFeatures': { + 'jsx': true + }, + 'sourceType': 'module' + } +}; +/// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +/** relaxations of rules that we don't mind */ +const INQ_RULES = { + 'prettier/prettier': ['warn'], + 'no-console': 'off', + 'no-debugger': 'warn', + 'no-alert': 'warn', + 'spaced-comment': 'off', + 'react/jsx-filename-extension': [ + 1, + { + 'extensions': ['.js', '.jsx'] + } + ], + 'no-unused-vars': 'off', + 'arrow-body-style': 'off', + 'camelcase': 'off', + 'no-use-before-define': 'off', + 'import/no-extraneous-dependencies': [ + 'error', + { + 'devDependencies': true + } + ], + 'no-underscore-dangle': 'off', + 'no-plusplus': 'off', + 'prefer-const': 'off', + 'one-var': 'off', + 'prefer-destructuring': 'off', + 'class-methods-use-this': 'off', + 'import/prefer-default-export': 'off', + // habit rules warnings + 'no-param-reassign': 'warn', + 'no-shadow': 'warn', + 'grouped-accessor-pairs': 'warn', + 'import/no-duplicates': ['warn', { 'considerQueryString': true }], + 'radix': 'as-needed' +}; +/// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +/** react rules that we don't like */ +const REACT_ICKS = { + 'react/no-unescaped-entities': 'off', + 'react/destructuring-assignment': 'off', + 'react/jsx-one-expression-per-line': 'off', + // new with removal of prettier/react, which is now included in prettier + 'react/no-unused-class-component-methods': 'off', + 'react/no-unused-prop-types': 'warn', + 'react/no-unused-state': 'warn', + 'react/prop-types': 'warn', + 'react/jsx-props-no-spreading': 'warn', + 'react/no-array-index-key': 'warn' +}; + +/// EXPORTS /////////////////////////////////////////////////////////////////// +/// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +module.exports = { + ...CONFIG, // base eslint config + rules: { + ...INQ_RULES, // default inq styles + ...REACT_ICKS + } +}; diff --git a/.eslintrc.json b/.eslintrc.json deleted file mode 100644 index 894b6a67..00000000 --- a/.eslintrc.json +++ /dev/null @@ -1,57 +0,0 @@ -{ - "env": { - "browser": true, - "commonjs": true, - "es6": true, - "node": true - }, - "plugins": ["import", "prettier", "react"], - "extends": ["airbnb", "prettier"], - "globals": { - "PACKAGE_TITLE": "readonly", // injected by webpack - "PACKAGE_VERSION": "readonly", // injected by webpack - "PACKAGE_DESCRIPTION":"readonly", // injected by webpack - "__static":"readonly" // injected by webpack - }, - "parserOptions": { - "ecmaVersion": 2020, - "ecmaFeatures": { - "jsx": true - }, - "sourceType": "module" - }, - "rules": { - "prettier/prettier": ["warn"], - "no-console": "off", - "no-debugger": "warn", - "no-alert": "warn", - "spaced-comment": "off", - "react/jsx-filename-extension": [ - 1, - { - "extensions": [".js", ".jsx"] - } - ], - "no-unused-vars": "off", - "arrow-body-style": "off", - "react/destructuring-assignment": "off", - "react/jsx-one-expression-per-line": "off", - "camelcase": "off", - "no-use-before-define": "off", - "import/no-extraneous-dependencies": [ - "error", - { - "devDependencies": true - } - ], - "no-underscore-dangle": "off", - "no-plusplus": "off", - "prefer-const": "off", - "prefer-destructuring": "off", - "class-methods-use-this": "off", - "no-param-reassign": "warn", - "react/prop-types": "warn", - "react/no-unescaped-entities": "off" - }, - "settings": {} -} diff --git a/.vscode/extensions.json b/.vscode/extensions.json index 8f5a55b0..de9a431e 100644 --- a/.vscode/extensions.json +++ b/.vscode/extensions.json @@ -6,7 +6,6 @@ "recommendations": [ "editorconfig.editorconfig", "dbaeumer.vscode-eslint", - "ms-vsliveshare.vsliveshare", "esbenp.prettier-vscode", "stkb.rewrap" ], diff --git a/.vscode/module.code-snippets b/.vscode/module.code-snippets index ae8725ca..c98dac49 100644 --- a/.vscode/module.code-snippets +++ b/.vscode/module.code-snippets @@ -12,175 +12,123 @@ // ], // "description": "Log output to console" // } - "dss bare module": { - "prefix": "sri-module-outline", - "description": "a bare module template (es6)", + "ursys bare module": { + "prefix": "ur-module-elements", + "description": "a bare module ", "body": [ "/*///////////////////////////////// ABOUT \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*\\", + "", + " $1description", + "", "\\*\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\ * /////////////////////////////////////*/", "", - "/// LIBRARIES /////////////////////////////////////////////////////////////////", - "/// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -\n", - "/// CONSTANTS /////////////////////////////////////////////////////////////////", - "/// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -\n", - "/// DECLARATIONS //////////////////////////////////////////////////////////////", - "/// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -\n", - "/// CLASS /////////////////////////////////////////////////////////////////////", - "/// PUBLIC METHODS ////////////////////////////////////////////////////////////", - "/// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -\n", - "/// STATIC METHODS ////////////////////////////////////////////////////////////", - "/// MODULE HELPERS ////////////////////////////////////////////////////////////", - "/// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -\n", - "/// INITIALIZATION ////////////////////////////////////////////////////////////", - "/// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -\n", + "/* import or require */", + "", + "/// CONSTANTS & DECLARATIONS //////////////////////////////////////////////////", + "/// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -", + "", + "", + "/// HELPER METHODS ////////////////////////////////////////////////////////////", + "/// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -", + "", + "", + "/// API METHODS ///////////////////////////////////////////////////////////////", + "/// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -", + "", + "", "/// EXPORTS ///////////////////////////////////////////////////////////////////", - "/// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -\n", - "/// export default MODULE; // import MOD from './module'", - "/// export default MyClass; // import MyClass from './module'", - "/// export { A, B }; // import { A, B } from './module'", - "/// export { A as B }; // import { B } from './module'", + "/// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -" ] }, - "dss header comment block": { - "prefix": "sri-comment-block-header", + "ursys header comment block": { + "prefix": "ur-comment-block-header", "description": "a comment block with header", "body": [ - "\n/// HEADER ////////////////////////////////////////////////////////////////////", + "", + "/// HEADER ////////////////////////////////////////////////////////////////////", "/*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*:", " extended comment", ":*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/\n" ] }, - "dss callout comment block": { - "prefix": "sri-comment-block", - "description": "comment block", + "ursys function header": { + "prefix": "ur-jsdoc-function-block", + "description": "JSDOC header for functions", "body": [ - "\n/*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*:", - " extended comment", - ":*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/\n" + "", + "/// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -", + "/** Description goes here", + " * @param {object} obj - description", + " * @oaram {string} obj.name - description", + " * @returns {object}", + " */" ] }, - "dss commonjs example": { - "prefix": "sri-module-commonjs", - "description": "an example module using CommonJS syntax (node)", + "ursys callout comment block": { + "prefix": "ur-comment-block", + "description": "comment block", "body": [ - "/*///////////////////////////////// ABOUT \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*\\", - "\n Dave.Sri CommonJS Module Format Template\n", - " see https://gitlab.com/inq-seeds/boilerplate/wikis/Module-Style for information\n", - "\\*\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\ * /////////////////////////////////////*/", - "const MyLibrary = require('./mylibrary');", - "const NpmPackage = require('npm-package');", - "const ClassName = require('./classes/class-name');", - "\n/// PRIVATE DECLARATIONS //////////////////////////////////////////////////////", - "/// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -", - "const TYPE_CONSTANT_A = 'A';", - "let m_collection = [];", - "\n/// PRIVATE HELPERS ///////////////////////////////////////////////////////////", - "/// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -", - "function m_Method() {", - " return 'hello';", - "}", - "\n/** Extended Comment Block ***************************************************\\\n", - " For in-line documentation or longer explanations of key classes", - " No need to add/remove comment prefixes for each line. JUST WRITE.", - "\n\\*****************************************************************************/", - "\n/// CLASS DECLARATION /////////////////////////////////////////////////////////", - "/// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -", - "class MyClass {", - " /* for declaring classes, one per file */", - " /* remove if you're making a module (see below) */", - "\n constructor() {", - " this.propertyZ = 'Z'; // class iinstance prop declaration", - " }", - "\n MyClassMethod() {", - " /* _NOT_ following lowercase method conventions */", - " m_collection.push(this.propertyZ);", - " }", - "}", - "// class static declarations", - "MyClass.StaticMethod = () => {", - " /* properties attached to class declaration are class-wide (static) */", - " /* and accessible by instances, but can not access instance vars (duh) */", - "};", - "MyClass.STATIC_CONSTANT = 'foo';", - "MyClass.staticProperty = 'bar';", - "\n/// PUBLIC METHODS ////////////////////////////////////////////////////////////", - "/// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -", - "const MODULE = {};", - "MODULE.propA = 'module property accessed with this or MOD';", - "/// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -", - "/// Description of PublicA", - "MODULE.PublicA = () => {", - " console.log(MODULE.propA);", - " console.log(this.propA); // for advanced javascript devs", - "};", - "/// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -", - "/// Description of PublicB", - "MODULE.PublicB = () => {", - " m_collection = [TYPE_CONSTANT_A, 'B', 'C'];", - "};", - "/// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -", - "/// Description of PublicC", - "MODULE.PublicC = () => {", - " if (DBG) console.log(`m_Method says ${m_Method()}`);", - "};", - "\n/// INITIALIZATION ////////////////////////////////////////////////////////////", - "/// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -", - "/// any code that runs when module is loaded", - "(function(){ /* something */ })();", - "\n/// EXPORTS ///////////////////////////////////////////////////////////////////", - "/// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -", - "module.exports = MODULE;", - "/* or for classes */", - "module.exports = MyClass;", - "" + "", + "/*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*:", + " extended comment", + ":*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/\n" ] }, - "dss es6module example": { - "prefix": "sri-module-es6", + "ursys module example": { + "prefix": "ur-module-example", "description": "an example module using ES6 syntax (webpack, parcel)", "body": [ "/*///////////////////////////////// ABOUT \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*\\", - "\n Dave.Sri ES6 Module Format Template\n", - " see https://gitlab.com/inq-seeds/boilerplate/wikis/Module-Style for information\n", + " ", + " Example of D.Sri's Module Style", + " Designed to be more like C# in its lettercasing conventions", + " ", + " ", "\\*\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\ * /////////////////////////////////////*/", - "import MyLibrary from './mylibrary';", - "import { MyFunctionA, ObjectB } from './mycollection';", - "import NpmPackage from 'npm-package';", - "import ClassName from './classes/class-name'", - "\n/// PRIVATE DECLARATIONS //////////////////////////////////////////////////////", + "", + "/// es6: import MODULEorCLASS from './module';", + "/// import { A, B } from './module';", + "/// cjs: const MODULEorCLASS = require('./module');", + "/// const { A, B } = require('./module');", + "", + "/// CONSTANTS & DECLARATIONS //////////////////////////////////////////////////", "/// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -", "const TYPE_CONSTANT_A = 'A';", "let m_collection = [];", - "\n/// PRIVATE HELPERS ///////////////////////////////////////////////////////////", + "", + "/// MODULE HELPERS /////////////////////////////////////////////////////////////", "/// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -", - "// function style 1 - classic!", + "/** jsdoc comment", + " * indent to align with top", + " */", "function m_Method() {", - " // classic function creates module-wide closure, ok to use for module-only", - " // within the module", + " // helper functions for the module begin with m_PascalCase within module", " m_collection.push('hello');", " return 'hello';", "}", - "// function style 2 - arrow functio", - "const eventHandler = event => {", - " // arrow functions always bind 'this', so good if call originates", - " // from outside the module or from an anonymous function", - " m_collection.push(event.target);", - "}", - "\n/** Extended Comment Block ***************************************************\\\n", + "", + "/** An Extended Comment Block *************************************************\\", + "", " For in-line documentation or longer explanations of key classes", " No need to add/remove comment prefixes for each line. JUST WRITE.", - "\n\\*****************************************************************************/", - "\n/// CLASS DECLARATION /////////////////////////////////////////////////////////", + "", + "\\*****************************************************************************/", + "", + "/// CLASS DECLARATION /////////////////////////////////////////////////////////", "/// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -", + "/** jsdoc comment", + " * indent", + " */", "class MyClass {", " /* for declaring classes, one per file */", " /* remove if you're making a module (see below) */", - "\n constructor() {", - " this.propertyZ = 'Z'; // class iinstance prop declaration", + "", + " constructor() {", + " this.propertyZ = 'Z'; // class instance prop declaration", " }", - "\n MyClassMethod() {", - " /* _NOT_ following lowercase method conventions */", + "", + " MyClassMethod() {", + " /* _NOT_ following lowercase method conventions because C# */", " m_collection.push(this.propertyZ);", " }", "}", @@ -191,37 +139,39 @@ "};", "MyClass.STATIC_CONSTANT = 'foo';", "MyClass.staticProperty = 'bar';", - "\n/// PUBLIC METHODS ////////////////////////////////////////////////////////////", - "/// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -", - "const MODULE = {};", - "MODULE.propA = 'module property accessed with this or MOD';", + "", + "/// PUBLIC METHODS ////////////////////////////////////////////////////////////", "/// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -", - "/// Description of PublicA", - "MODULE.PublicA = () => {", - " console.log(MODULE.propA);", - " console.log(this.propA); // for advanced javascript devs", - "};", + "/** jsdoc comment", + " * indent", + " */", + "function PublicA() {}", "/// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -", - "/// Description of PublicB", - "MODULE.PublicB = () => {", - " m_collection = [TYPE_CONSTANT_A, 'B', 'C'];", - "};", + "/** jsdoc comment", + " * indent", + " */", + "function PublicB() {}", + "", + "/// PHASE MACHINE DIRECT INTERFACE ////////////////////////////////////////////", "/// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -", - "/// Description of PublicC", - "MODULE.PublicC = () => {", - " if (DBG) console.log(`m_Method says ${m_Method()}`);", - "};", - "\n/// INITIALIZATION ////////////////////////////////////////////////////////////", + "UR.HookPhase('MACHINE','PHASE',(...args)=>{", + " /* optionally return Promise to hold phase (e.g. asset loading) */", + "})", + "", + "/// INITIALIZATION ////////////////////////////////////////////////////////////", "/// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -", "/// any code that runs when module is loaded", - "(function(){ /* something */ })();", - "\n/// EXPORTS ///////////////////////////////////////////////////////////////////", + "(function(){", + " /* use immediately-invoked function express (IIFE) for scope safety */", + " /* though you probably don't need to */", + "})();", + "", + "/// EXPORTS ///////////////////////////////////////////////////////////////////", "/// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -", - "/// NOTE: ES6 exports are currently tricky due to transition from commonjs.", - "/// Using single export (default) works for us now, though not optimal", - "/// export default MODULE; // import MOD from './module'", - "/// export default MyClass; // import MyClass from './module'", - "/// export default { eventHandler, MODULE }; // import MOD from './module'", + "/// es6: export default MODULEorCLASS;", + "/// export { PublicA, PublicB };", + "/// cjs: module.exports = MODULEorCLASS;", + "/// module.exports = { A, B };", "" ] } diff --git a/.vscode/settings.json b/.vscode/settings.json index 85bc6658..27adb12e 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -1,34 +1,19 @@ { - "editor.renderWhitespace": "all", - "editor.wordWrap": "on", - "typescript.suggest.completeJSDocs": false, - "prettier.printWidth": 100, - - "[json]": { - "editor.formatOnSave": true, - "editor.defaultFormatter": "esbenp.prettier-vscode", - "editor.wordWrap": "off" - }, - "[javascript]": { - "editor.formatOnSave": true, - "editor.defaultFormatter": "esbenp.prettier-vscode", - "editor.wordWrap": "off" - }, + "editor.wordWrap": "off", + "editor.defaultFormatter": "esbenp.prettier-vscode", + "editor.formatOnSave": true, "[markdown]": { - "editor.formatOnSave": false + "editor.formatOnSave": false, + "editor.wordWrap": "on" }, "[javascriptreact]": { - "editor.defaultFormatter": "esbenp.prettier-vscode", - "editor.formatOnSave": true, - "editor.wordWrap": "off" + "editor.defaultFormatter": "esbenp.prettier-vscode" }, - "[html]": { - "editor.defaultFormatter": "esbenp.prettier-vscode", - "editor.wordWrap": "off" - }, - "eslint.workingDirectories": [ - { - "mode": "auto" - } + "typescript.suggest.completeJSDocs": false, + "eslint.validate": [ + "javascript", + "javascriptreact", + "typescript", + "typescriptreact" ] } diff --git a/.vscode/vs_env b/.vscode/vs_env index 300767df..f519dc34 100644 --- a/.vscode/vs_env +++ b/.vscode/vs_env @@ -1,5 +1,28 @@ -# The following script is invoked on Apple OSX machines -# in the .code-workspace setting "terminal.integrated.profiles.osx" +# vs_env - Sri's Visual Studio Code Environment Script +# +# The following script is source'd from inside a Visual Studio Code integrated terminal +# and is located in a workspace .vscode folder. Accompanying changes must be made to +# the .code-workspace file to enable this script to run. As an example, these settings +# in the .code-workspace file will first force x86 mode on an ARM-based Mac through +# Rosetta 2, and then run the script vs_env script +# +# "terminal.integrated.profiles.osx": { +# "x86 macos": { +# "path": "/usr/bin/arch", +# "args": [ +# "-arch", +# "x86_64", +# "${env:SHELL}", +# "-i", +# "-c", +# "export VSCODE_TERM='x86 shell';source ${workspaceFolder}/.vscode/vs_env; exec ${env:SHELL}" +# ] +# } +# }, +# "terminal.integrated.defaultProfile.osx": "x86 macos", +# +# For more information on terminal profiles in vscode, see +# https://code.visualstudio.com/docs/terminal/profiles # ANSI Terminal Colors ALRT="\033[33;1m" # yellow @@ -13,8 +36,8 @@ if [ -z "$NVM_DIR" ]; then printf "vsenv: ${ALRT}NVM does not appear to be installed${NRML}\n" printf " Does your ${INFO}~/.zshrc${NRML} have ${INFO}export NVM_DIR${NRML} lines?\n" printf "\n" - printf " If you haven't installed nvm yet, please follow the instructions\n" - printf " on the NetCreate wiki.\n" + printf " If you haven't yet installed nvm, please follow the instructions\n" + printf " at https://github.com/nvm-sh/nvm to install it." printf " If you are using 'bash' as your default shell, you can copy\n" printf " these lines to your .zshrc file so nvm will also work in zsh.\n" return @@ -24,17 +47,26 @@ fi # is NVM is installed, there is a .nvmrc file and a .vscode directory? if [ -n "$NVM_DIR" ] && [ -s "./.nvmrc" ] && [ -d "./.vscode" ]; then NVM_RC=$(cat ./.nvmrc) - NODE_VERSION=$(nvm version $NVM_RC) - NODE_LABEL="$NVM_RC" - if [ "$NVM_RC" != "$NODE_VERSION" ]; then - NODE_LABEL="$NODE_LABEL ($NODE_VERSION)" + REQ_VERSION=$(nvm version $NVM_RC) + if [ "$REQ_VERSION" = "N/A" ]; then + REQ_VERSION="$NVM_RC" + fi + + CUR_VERSION=$(nvm current) + NODE_LABEL="$CUR_VERSION" + if [ "$NVM_RC" != "$REQ_VERSION" ]; then + NODE_LABEL="$NODE_LABEL ($REQ_VERSION)" fi printf "\n" printf "vsenv: VISUAL STUDIO CODE INTEGRATED TERMINAL DETECTED\n" + ARCH_LABEL=$(uname -m) + printf " detected architecture is ${INFO}$ARCH_LABEL${NRML}\n" + if [ "$CUR_VERSION" != "$REQ_VERSION" ]; then + printf " ${ALRT}required node version is ${INFO}$REQ_VERSION${NRML}\n" + fi printf " detected node version is ${INFO}$NODE_LABEL${NRML}\n" - ARCH=$(uname -m) - printf " detected architecture is ${INFO}$ARCH${NRML} (can override in code-workspace)\n" + # check if node binary is in the path if ! command -v node &> /dev/null; then @@ -50,14 +82,13 @@ if [ -n "$NVM_DIR" ] && [ -s "./.nvmrc" ] && [ -d "./.vscode" ]; then printf "\n" printf "vsenv: node binary found at ${INFO}$(command -v node)${NRML}\n" fi - - CURRENT_VERSION=$(node --version) - if [ "$CURRENT_VERSION" != "$NODE_VERSION" ] && [ -n "$str_alias" ]; then + + if [ "$CUR_VERSION" != "$REQ_VERSION" ]; then printf "\n" printf "vsenv: ** WARNING **\n" - printf " This shell is using version ${INFO}$CURRENT_VERSION${NRML}, not the ${ALRT}specified ${INFO}$NODE_VERSION${NRML} in .nvmrc\n" + printf " This shell is using version ${INFO}$CUR_VERSION${NRML}, not the ${ALRT}specified ${INFO}$REQ_VERSION${NRML} in .nvmrc\n" printf " Type ${ALRT}nvm use${NRML} to use .nvmrc version. You may need to run ${ALRT}npm ci${NRML} again.\n" - printf " If you want to use this version as default, type ${ALRT}nvm alias default $NODE_VERSION${NRML}\n" + printf " If you want to use this version as default, type ${ALRT}nvm alias default $REQ_VERSION${NRML}\n" fi else printf "\n" diff --git a/boilerplate-readme.md b/meme-readme.md similarity index 100% rename from boilerplate-readme.md rename to meme-readme.md diff --git a/src/app-web/components/EvidenceNotes.jsx b/src/app-web/components/EvidenceNotes.jsx index e4d3c6ac..0e941b79 100644 --- a/src/app-web/components/EvidenceNotes.jsx +++ b/src/app-web/components/EvidenceNotes.jsx @@ -4,9 +4,11 @@ EvidenceNotes Joshua whipped this up, so it might need some tightening. -The basic idea is to look for markdown style "Evidence links" in the comment text and a) note it and b) make a link to it. +The basic idea is to look for markdown style "Evidence links" in the comment +text and a) note it and b) make a link to it. -NOTE: The styling is off / we should be using VBadges but it was too much of a hassle for me to figure out how. +NOTE: The styling is off / we should be using VBadges but it was too much of a +hassle for me to figure out how. \*\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\ * /////////////////////////////////////*/ @@ -15,15 +17,18 @@ import UR from '../../system/ursys'; import './EvidenceNotes.css'; // Import the CSS file for styling class EvidenceNotes extends React.Component { - handleEvidenceClick = (evNumber, evLetter) => { + handleEvidenceClick(evNumber, evLetter) { // Convert evNumber to a number const evNumberAsNumber = parseInt(evNumber, 10); // Check if evLetter is not null and convert it to a number const evLetterAsNumber = evLetter !== null ? evLetter.charCodeAt(0) - 96 : null; - UR.Publish('SHOW_EVIDENCE_LINK', { evId: evLetterAsNumber, rsrcId: evNumberAsNumber }); - }; + UR.Publish('SHOW_EVIDENCE_LINK', { + evId: evLetterAsNumber, + rsrcId: evNumberAsNumber + }); + } render() { const { comment, isBeingEdited } = this.props || ''; @@ -49,6 +54,7 @@ class EvidenceNotes extends React.Component { return (