Skip to content

Commit

Permalink
chore: intial setup
Browse files Browse the repository at this point in the history
  • Loading branch information
lublagg committed Nov 12, 2024
0 parents commit cde06fd
Show file tree
Hide file tree
Showing 29 changed files with 18,301 additions and 0 deletions.
9 changes: 9 additions & 0 deletions .eslintrc.build.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
// build/production configuration extends default/development configuration
module.exports = {
extends: "./.eslintrc.js",
rules: {
"eslint-comments/no-unused-disable": "warn",
"no-console": ["warn", { allow: ["warn", "error"] }],
"no-debugger": "error"
}
};
144 changes: 144 additions & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,144 @@
module.exports = {
parser: "@typescript-eslint/parser",
parserOptions: {
ecmaVersion: 2018,
sourceType: "module",
},
plugins: ["@typescript-eslint", "json", "react", "react-hooks"],
env: {
browser: true,
es6: true
},
settings: {
"import/parsers": {
"@typescript-eslint/parser": [".ts", ".tsx"]
},
"import/resolver": {
typescript: {
alwaysTryTypes: true,
project: "."
}
},
react: {
pragma: "React",
version: "detect"
}
},
ignorePatterns: [
"dist/", "node_modules/"
],
extends: [
"eslint:recommended",
"plugin:@typescript-eslint/recommended",
"plugin:eslint-comments/recommended",
"plugin:import/recommended",
"plugin:import/typescript",
"plugin:json/recommended",
"plugin:react/recommended",
"plugin:react-hooks/recommended"
],
rules: {
"@typescript-eslint/explicit-module-boundary-types": "off",
"@typescript-eslint/no-confusing-non-null-assertion": "error",
"@typescript-eslint/no-empty-interface": "off",
"@typescript-eslint/no-explicit-any": "off",
"@typescript-eslint/no-require-imports": "error",
"@typescript-eslint/no-shadow": ["warn", { builtinGlobals: false, hoist: "all", allow: [] }],
"@typescript-eslint/no-this-alias": "off",
"@typescript-eslint/no-unused-vars": ["warn", { args: "none", ignoreRestSiblings: true }],
"@typescript-eslint/prefer-optional-chain": "off",
"@typescript-eslint/semi": ["warn", "always"],
"curly": ["error", "multi-line", "consistent"],
"dot-notation": "error",
"eol-last": "warn",
"eqeqeq": ["error", "smart"],
"eslint-comments/no-unused-disable": "off", // enabled in .eslintrc.build.js
"import/no-cycle": "warn",
"import/no-extraneous-dependencies": "warn",
"import/no-useless-path-segments": "warn",
"jsx-quotes": ["error", "prefer-double"],
"max-len": ["off", { code: 120, ignoreUrls: true }],
"no-bitwise": "error",
"no-debugger": "off",
"no-duplicate-imports": "error",
"no-sequences": "error",
"no-shadow": "off", // superseded by @typescript-eslint/no-shadow
"no-tabs": "error",
"no-unneeded-ternary": "error",
"no-unused-expressions": ["error", { allowShortCircuit: true }],
"no-unused-vars": "off", // superseded by @typescript-eslint/no-unused-vars
"no-useless-call": "error",
"no-useless-concat": "error",
"no-useless-rename": "error",
"no-useless-return": "error",
"no-var": "error",
"no-whitespace-before-property": "error",
"object-shorthand": "error",
"prefer-const": ["off", { destructuring: "all" }],
"prefer-object-spread": "error",
"prefer-regex-literals": "error",
"prefer-rest-params": "off",
"prefer-spread": "error",
"quotes": ["error", "double", { allowTemplateLiterals: true, avoidEscape: true }],
"radix": "error",
"react/jsx-closing-tag-location": "error",
"react/jsx-handler-names": "off",
"react/jsx-no-useless-fragment": "error",
"react/no-access-state-in-setstate": "error",
"react/no-danger": "error",
"react/no-unsafe": ["off", { checkAliases: true }],
"react/no-unused-state": "error",
"react/prop-types": "off",
"semi": "off" // superseded by @typescript-eslint/semi
},
overrides: [
{ // rules specific to Jest tests
files: ["src/**/*.test.*"],
env: {
node: true,
jest: true
},
plugins: ["jest", "testing-library"],
extends: ["plugin:jest/recommended", "plugin:testing-library/react"],
rules: {
"@typescript-eslint/no-non-null-assertion": "off",
// require() can be useful in mocking
"@typescript-eslint/no-require-imports": "off",
"@typescript-eslint/no-var-requires": "off",
"jest/no-done-callback": "off"
}
},
{ // rules specific to Cypress tests
files: ["cypress/**"],
env: {
node: true,
"cypress/globals": true
},
plugins: ["cypress"],
extends: ["plugin:cypress/recommended"],
rules: {
"@typescript-eslint/no-require-imports": "off",
"@typescript-eslint/no-non-null-assertion": "off",
"@typescript-eslint/no-var-requires": "off",
"cypress/no-unnecessary-waiting": "off"
}
},
{ // eslint configs
files: [".eslintrc*.js"],
env: {
node: true
}
},
{ // webpack configs
files: ["**/webpack.config.js"],
env: {
node: true
},
rules: {
"@typescript-eslint/no-require-imports": "off",
"@typescript-eslint/no-var-requires": "off",
"quotes": ["error", "single", { allowTemplateLiterals: true, avoidEscape: true }],
}
}
]
};
8 changes: 8 additions & 0 deletions .eslintrc.style.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
module.exports = {
extends: "./.eslintrc.js",
rules: {
"array-bracket-spacing": ["error", "never"],
"object-curly-spacing": ["error", "always"],
"react/jsx-curly-spacing": ["error", { "when": "never", "children": { "when": "always" } }],
}
};
16 changes: 16 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# dependencies
/node_modules

# testing
/coverage

# production
/build
/dist

# OS
.DS_Store

# Logs
npm-debug.log*
npm-error.log*
21 changes: 21 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2018 Concord Consortium

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
64 changes: 64 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
# Data Analysis through Voice and Artificial Intelligence

## Development

### Initial steps

1. Clone this repo and `cd` into it
2. Run `npm install` to pull dependencies
3. Run `npm start` to run `webpack-dev-server` in development mode with hot module replacement

## Testing the plugin in CODAP

Currently there is no trivial way to load a plugin running on a local server with `http` into the online CODAP, which forces `https`. One simple solution is to download the latest `build_[...].zip` file from https://codap.concord.org/releases/zips/, extract it to a folder and run it locally. If CODAP is running on port 8080, and this project is running by default on 3000, you can go to

http://127.0.0.1:8080/static/dg/en/cert/index.html?di=http://localhost:3000

to see the plugin running in CODAP.

# Create React App Readme

This project was bootstrapped with [Create React App](https://github.com/facebook/create-react-app).

## Available Scripts

In the project directory, you can run:

### `npm start`

Runs the app in the development mode.<br>
Open [http://localhost:3000](http://localhost:3000) to view it in the browser.

The page will reload if you make edits.<br>
You will also see any lint errors in the console.

### `npm test`

Launches the test runner in the interactive watch mode.<br>
See the section about [running tests](https://facebook.github.io/create-react-app/docs/running-tests) for more information.

### `npm run build`

Builds the app for production to the `build` folder.<br>
It correctly bundles React in production mode and optimizes the build for the best performance.

The build is minified and the filenames include the hashes.<br>
Your app is ready to be deployed!

See the section about [deployment](https://facebook.github.io/create-react-app/docs/deployment) for more information.

### `npm run eject`

**Note: this is a one-way operation. Once you `eject`, you can’t go back!**

If you aren’t satisfied with the build tool and configuration choices, you can `eject` at any time. This command will remove the single build dependency from your project.

Instead, it will copy all the configuration files and the transitive dependencies (Webpack, Babel, ESLint, etc) right into your project so you have full control over them. All of the commands except `eject` will still work, but they will point to the copied scripts so you can tweak them. At this point you’re on your own.

You don’t have to ever use `eject`. The curated feature set is suitable for small and middle deployments, and you shouldn’t feel obligated to use this feature. However we understand that this tool wouldn’t be useful if you couldn’t customize it when you are ready for it.

## Learn More

You can learn more in the [Create React App documentation](https://facebook.github.io/create-react-app/docs/getting-started).

To learn React, check out the [React documentation](https://reactjs.org/).
20 changes: 20 additions & 0 deletions cypress.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
import { defineConfig } from 'cypress'

export default defineConfig({
video: false,
fixturesFolder: false,
projectId: 'r9de4a',
defaultCommandTimeout: 8000,
env: {
coverage: false,
},
e2e: {
// We've imported your old cypress plugins here.
// You may want to clean this up later by importing these.
setupNodeEvents(on, config) {
return require("@cypress/code-coverage/task")(on, config);
},
baseUrl: 'http://localhost:8080',
specPattern: 'cypress/e2e/**/*.{js,jsx,ts,tsx}',
},
})
13 changes: 13 additions & 0 deletions cypress/e2e/workspace.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import { AppElements as ae } from "../support/elements/app-elements";

context("Test the overall app", () => {
beforeEach(() => {
cy.visit("");
});

describe("Desktop functionalities", () => {
it("renders with text", () => {
ae.getApp().should("have.text", "Hello World");
});
});
});
23 changes: 23 additions & 0 deletions cypress/support/e2e.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
// ***********************************************************
// This example support/index.js is processed and
// loaded automatically before your test files.
//
// This is a great place to put global configuration and
// behavior that modifies Cypress.
//
// You can change the location of this file or turn off
// automatically serving support files with the
// 'supportFile' configuration option.
//
// You can read more here:
// https://on.cypress.io/configuration
// ***********************************************************

// Import commands.js using ES2015 syntax:
// import "./commands";

// Alternatively you can use CommonJS syntax:
// require('./commands')

// add code coverage support
import "@cypress/code-coverage/support";
5 changes: 5 additions & 0 deletions cypress/support/elements/app-elements.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
export const AppElements = {
getApp() {
return cy.get(".app");
}
};
8 changes: 8 additions & 0 deletions cypress/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"compilerOptions": {
"target": "es5",
"lib": ["es5", "dom"],
"types": ["cypress", "node"]
},
"include": ["**/*.ts"]
}
Loading

0 comments on commit cde06fd

Please sign in to comment.