Skip to content
Snippets Groups Projects
Commit 0100c1f5 authored by amasek6's avatar amasek6
Browse files

adding react-redux starter code

parent e81ec480
No related branches found
No related tags found
No related merge requests found
Showing
with 30272 additions and 93 deletions
# Disable line-ending conversions for this repository.
* -text
# dependencies
/node_modules
# testing
/coverage
# production
/build
# environments
.env.local
.env.development.local
.env.test.local
.env.production.local
# logs
npm-debug.log*
yarn-debug.log*
yarn-error.log*
# misc
*~
.DS_Store
[submodule "stylelint-config"]
path = stylelint-config
url = git@git.unl.edu:soft-core/soft-260/stylelint-config.git
[submodule "eslint-config"]
path = eslint-config
url = git@git.unl.edu:soft-core/soft-260/eslint-config.git
# Disable line-ending conversions for this repository.
* -text
# dependencies
/node_modules
# testing
/coverage
# production
/build
# environments
.env.local
.env.development.local
.env.test.local
.env.production.local
# logs
npm-debug.log*
yarn-debug.log*
yarn-error.log*
# misc
*~
.DS_Store
module.exports = {
'env': {
'es2020': true,
'browser': true,
'node': true,
'jest': true,
},
'parserOptions': {
'ecmaVersion': 2022,
'sourceType': 'module',
'ecmaFeatures': {
'jsx': true,
},
},
'rules': {
'accessor-pairs': 'warn',
'array-bracket-spacing': 'warn',
'array-callback-return': 'warn',
'arrow-body-style': 'warn',
'arrow-parens': 'warn',
'arrow-spacing': 'warn',
'block-scoped-var': 'warn',
'block-spacing': 'warn',
'brace-style': 'warn',
'camelcase': 'warn',
'comma-dangle': ['warn', 'always-multiline'],
'comma-spacing': 'warn',
'comma-style': 'warn',
'computed-property-spacing': 'warn',
'consistent-return': 'warn',
'consistent-this': 'warn',
'constructor-super': 'warn',
'curly': 'warn',
'default-case': [
'warn',
],
'dot-location': ['warn', 'property'],
'dot-notation': 'warn',
'eol-last': 'warn',
'eqeqeq': 'warn',
'func-call-spacing': 'warn',
'func-name-matching': 'warn',
'func-names': ['warn', 'as-needed'],
'generator-star-spacing': ['warn', 'neither'],
'getter-return': 'warn',
'guard-for-in': 'off', // see no-restricted-syntax
'id-blacklist': ['warn', 'temp'],
'indent': ['warn', 2],
'init-declarations': 'warn',
'jsx-quotes': 'warn',
'key-spacing': 'warn',
'keyword-spacing': 'warn',
'linebreak-style': 'warn',
'lines-around-directive': 'warn',
'max-len': [
'warn',
{
'code': 120,
},
],
'max-statements-per-line': 'warn',
'new-cap': 'warn',
'new-parens': 'warn',
'no-alert': 'warn',
'no-array-constructor': 'warn',
'no-caller': 'warn',
'no-case-declarations': 'warn',
'no-catch-shadow': 'warn',
'no-class-assign': 'warn',
'no-compare-neg-zero': 'warn',
'no-cond-assign': 'warn',
'no-const-assign': 'warn',
'no-constant-condition': 'warn',
'no-control-regex': 'warn',
'no-debugger': 'warn',
'no-delete-var': 'warn',
'no-div-regex': 'warn',
'no-dupe-args': 'warn',
'no-dupe-class-members': 'warn',
'no-dupe-keys': 'warn',
'no-duplicate-case': 'warn',
'no-duplicate-imports': 'warn',
'no-else-return': 'warn',
'no-empty': 'warn',
'no-empty-character-class': 'warn',
'no-empty-pattern': 'warn',
'no-eq-null': 'warn',
'no-eval': 'warn',
'no-ex-assign': 'warn',
'no-extend-native': 'warn',
'no-extra-bind': 'warn',
'no-extra-boolean-cast': 'warn',
'no-extra-label': 'warn',
'no-extra-parens': [
'warn',
'all',
{
'nestedBinaryExpressions': false,
},
],
'no-extra-semi': 'warn',
'no-fallthrough': [
'warn',
],
'no-floating-decimal': 'warn',
'no-func-assign': 'warn',
'no-global-assign': 'warn',
'no-implicit-coercion': 'warn',
'no-implied-eval': 'warn',
'no-inner-declarations': 'warn',
'no-invalid-regexp': 'warn',
'no-irregular-whitespace': 'warn',
'no-iterator': 'warn',
'no-label-var': 'warn',
'no-labels': [
'warn',
{
'allowLoop': true,
'allowSwitch': false,
},
],
'no-lone-blocks': 'warn',
'no-lonely-if': 'warn',
'no-loop-func': 'warn',
'no-mixed-operators': [
'warn',
{
'groups': [
['&', '|', '^', '~', '<<', '>>', '>>>'],
['==', '!=', '===', '!==', '>', '>=', '<', '<='],
['&&', '||'],
['in', 'instanceof'],
],
'allowSamePrecedence': false,
},
],
'no-mixed-spaces-and-tabs': 'warn',
'no-multi-assign': 'warn',
'no-multi-spaces': 'warn',
'no-multi-str': 'warn',
'no-multiple-empty-lines': [
'warn',
{
'maxBOF': 0,
'max': 1,
'maxEOF': 0,
},
],
'no-native-reassign': 'warn',
'no-negated-in-lhs': 'warn',
'no-new': 'warn',
'no-new-func': 'warn',
'no-new-object': 'warn',
'no-new-symbol': 'warn',
'no-new-wrappers': 'warn',
'no-obj-calls': 'warn',
'no-octal': 'warn',
'no-octal-escape': 'warn',
'no-param-reassign': 'warn',
'no-proto': 'warn',
'no-prototype-builtins': 'warn',
'no-redeclare': [
'warn',
{
'builtinGlobals': true,
},
],
'no-regex-spaces': 'warn',
'no-restricted-globals': 'warn',
'no-restricted-properties': 'warn',
'no-restricted-syntax': [
'warn',
{
'selector': 'ForInStatement',
'message': 'for-in loop used (did you mean to write a for-of loop?)',
},
{
'selector': 'BinaryExpression[operator=\'in\']',
'message': 'in operator used (did you mean to call a membership-testing method?)',
},
],
'no-return-assign': 'warn',
'no-return-await': 'off',
'no-script-url': 'warn',
'no-self-assign': 'warn',
'no-self-compare': 'warn',
'no-sequences': 'warn',
'no-shadow': 'warn',
'no-shadow-restricted-names': 'warn',
'no-sparse-arrays': 'warn',
'no-tabs': 'warn',
'no-template-curly-in-string': 'warn',
'no-this-before-super': 'warn',
'no-throw-literal': 'warn',
'no-trailing-spaces': 'warn',
'no-undef': 'warn',
'no-underscore-dangle': [
'warn',
{
'allowAfterThis': true,
'allowAfterSuper': true,
},
],
'no-unexpected-multiline': 'warn',
'no-unmodified-loop-condition': 'warn',
'no-unneeded-ternary': 'warn',
'no-unreachable': 'warn',
'no-unsafe-finally': 'warn',
'no-unsafe-negation': 'warn',
'no-unused-expressions': [
'warn',
{
'allowShortCircuit': false,
'allowTernary': false,
'allowTaggedTemplates': false,
},
],
'no-unused-labels': 'warn',
'no-unused-vars': [
'warn',
{
'args': 'none',
'ignoreRestSiblings': false,
'varsIgnorePattern': '^_',
},
],
'no-use-before-define': [
'warn',
{
'functions': false,
'classes': true,
'variables': true,
},
],
'no-useless-call': 'warn',
'no-useless-computed-key': 'warn',
'no-useless-concat': 'warn',
'no-useless-constructor': 'warn',
'no-useless-escape': 'warn',
'no-useless-rename': 'warn',
'no-useless-return': 'warn',
'no-var': 'warn',
'no-void': 'warn',
'no-warning-comments': 'warn',
'no-whitespace-before-property': 'warn',
'no-with': 'warn',
'nonblock-statement-body-position': 'off', // see curly
'object-curly-newline': 'warn',
'object-curly-spacing': ['warn', 'always'],
'object-property-newline': 'warn',
'object-shorthand': 'warn',
'one-var': ['warn', 'never'],
'one-var-declaration-per-line': 'warn',
'operator-assignment': 'warn',
'operator-linebreak': ['warn', 'after'],
'padded-blocks': ['warn', 'never'],
'prefer-arrow-callback': 'warn',
'prefer-const': 'warn',
'prefer-numeric-literals': 'warn',
'prefer-promise-reject-errors': 'warn',
'prefer-rest-params': 'warn',
'prefer-spread': 'warn',
'prefer-template': 'warn',
'quote-props': ['warn', 'as-needed'],
'quotes': ['warn', 'single'],
'radix': 'warn',
'require-await': 'warn',
'require-yield': 'warn',
'rest-spread-spacing': 'warn',
'semi': 'warn',
'semi-spacing': 'warn',
'space-before-function-paren': ['warn', 'never'],
'space-in-parens': 'warn',
'space-infix-ops': 'warn',
'space-unary-ops': 'warn',
'spaced-comment': 'warn',
'strict': ['warn', 'never'],
'symbol-description': 'warn',
'template-curly-spacing': 'warn',
'unicode-bom': 'warn',
'use-isnan': 'warn',
'valid-jsdoc': 'warn',
'valid-typeof': 'warn',
'wrap-iife': 'warn',
'yield-star-spacing': 'warn',
'yoda': 'warn',
},
'overrides': [
{
'files': '*.test.js',
'rules': {
'dot-notation': 'off',
'import/first': 'off',
'no-underscore-dangle': 'off',
'quote-props': 'off',
'require-await': 'off',
'no-magic-numbers': 'off',
},
},
],
'reportUnusedDisableDirectives': true,
};
module.exports = {
'extends': './base',
'rules': {
'no-magic-numbers': ['warn', {
'ignore': [-1, -0.5, 0, 0.001, 0.5, 1, 2, 10, 100, 180, 360, 1000, '-1n', '0n', '1n', '2n', '4n'],
'detectObjects': true,
}],
},
'overrides': [
{
'files': '*.test.js',
'rules': {
'no-magic-numbers': 'off',
},
},
],
}
This diff is collapsed.
{
"name": "@unlsoft/eslint-config",
"version": "3.0.0",
"description": "ESLint configuration used by the UNL SOFT core courses.",
"private": true,
"license": "UNLICENSED",
"devDependencies": {
"eslint": ">= 8"
},
"peerDependencies": {
"eslint": ">= 8"
}
}
module.exports = {
'extends': './base',
'rules': {
'no-magic-numbers': ['warn', {
'ignore': [-1, -0.5, 0, 0.001, 0.5, 1, 2, 10, 100, 180, 360, 1000],
'detectObjects': true,
}],
// `testing-library/no-node-access` is currently broken and gives false
// positives on mock implementations that use `props.children`.
'testing-library/no-node-access': 'off',
},
'overrides': [
{
'files': '*.test.js',
'rules': {
'no-magic-numbers': 'off',
},
},
],
}
# dependencies
/node_modules
# testing
/coverage
# production
/build
# environments
.env.local
.env.development.local
.env.test.local
.env.production.local
# logs
npm-debug.log*
yarn-debug.log*
yarn-error.log*
# misc
*~
.DS_Store
This diff is collapsed.
{
"name": "@unlsoft/minimal-app",
"version": "1.0.0",
"description": "A minimal app to be used as starter code for labs and homework.",
"private": true,
"license": "UNLICENSED",
"scripts": {
"lint:css": "stylelint \"**/*.css\" \"**/*.module.css\" \"!coverage/**\"",
"lint:js": "eslint --max-warnings 0 ./src",
"lint": "run-s --continue-on-error lint:**",
"test-once": "react-scripts test --watchAll=false --coverage",
"test": "react-scripts test --watchAll --coverage",
"start": "react-scripts start",
"build": "react-scripts build",
"eject": "react-scripts eject"
},
"homepage": ".",
"dependencies": {
"@reduxjs/toolkit": "^1.8.3",
"@testing-library/jest-dom": "^5.16.4",
"@testing-library/react": "^13.3.0",
"@testing-library/user-event": "^14.3.0",
"classnames": "^2.3.1",
"npm-run-all": "^4.1.5",
"react": "^18.2.0",
"react-dom": "^18.2.0",
"react-redux": "^8.0.2",
"react-router-dom": "^6.3.0",
"react-scripts": "^5.0.1",
"workbox-background-sync": "^6.5.3",
"workbox-broadcast-update": "^6.5.3",
"workbox-cacheable-response": "^6.5.3",
"workbox-core": "^6.5.3",
"workbox-expiration": "^6.5.3",
"workbox-navigation-preload": "^6.5.3",
"workbox-precaching": "^6.5.3",
"workbox-range-requests": "^6.5.3",
"workbox-routing": "^6.5.3",
"workbox-strategies": "^6.5.3",
"workbox-streams": "^6.5.3"
},
"devDependencies": {
"@babel/plugin-proposal-private-property-in-object": "^7.21.11",
"@unlsoft/eslint-config": "file:../eslint-config",
"@unlsoft/stylelint-config": "file:../stylelint-config",
"eslint-plugin-jest-dom": "^4.0.2",
"stylelint": "^14.9.1"
},
"stylelint": {
"extends": "@unlsoft/stylelint-config"
},
"eslintConfig": {
"extends": [
"react-app",
"react-app/jest",
"plugin:jest-dom/recommended",
"plugin:testing-library/react",
"@unlsoft/eslint-config/react"
]
},
"jest": {
"clearMocks": true,
"collectCoverageFrom": [
"src/features/**/*.js"
],
"resetMocks": false,
"restoreMocks": false
},
"browserslist": {
"production": [
">0.2%",
"not dead",
"not op_mini all"
],
"development": [
"last 1 chrome version",
"last 1 firefox version",
"last 1 safari version"
]
}
}
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<link rel="manifest" href="%PUBLIC_URL%/manifest.json" />
<meta
name="description"
content="A minimal app to be used as starter code for labs and homework."
/>
<meta name="theme-color" content="#d00000" />
<link rel="icon" href="%PUBLIC_URL%/logo.png" />
<link rel="icon" href="%PUBLIC_URL%/logo.svg" />
<link rel="apple-touch-icon" href="%PUBLIC_URL%/logo.png" />
<link rel="apple-touch-icon" href="%PUBLIC_URL%/logo.svg" />
<link rel="apple-touch-startup-image" href="%PUBLIC_URL%/logo.png" />
<link rel="apple-touch-startup-image" href="%PUBLIC_URL%/logo.svg" />
<title>Minimal React Redux App</title>
</head>
<body>
<noscript>You need to enable JavaScript to run this app.</noscript>
<div id="root"></div>
</body>
</html>
minimal-app/public/logo.png

9.58 KiB

<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 152 152">
<rect x="0" y="0" width="152" height="152" fill="rgba(0 0 0 / 100%)" />
<path d="M147,1H90V42h10V75.673L53.532,2.393,52.648,1H2V42H12v66H2v41H62V108H52V74.336l46.467,73.271L99.351,149H150V108H140V42h10V1Z" stroke-width="3" stroke="rgba(255 255 255 / 100%)" fill="rgba(208 0 0 / 100%)">
</path>
</svg>
{
"short_name": "Minimal App",
"name": "Minimal React Redux App",
"description": "A minimal app to be used as starter code for labs and homework.",
"icons": [
{
"src": "logo.svg",
"type": "image/svg+xml",
"sizes": "192x192 512x512",
"purpose": "any maskable"
},
{
"src": "logo.png",
"type": "image/png",
"sizes": "512x512",
"purpose": "any maskable"
}
],
"start_url": ".",
"display": "standalone",
"orientation": "portrait",
"theme_color": "#d00000",
"background_color": "#ffffff"
}
// Jest Snapshot v1, https://goo.gl/fbAQLP
exports[`the app has one labeled button that displays the value from the store 1`] = `
<div>
<label>
Taps
:
<button
class="blue"
>
9999
</button>
</label>
</div>
`;
import { Routes, Route } from 'react-router-dom';
import { Counter } from './features/counter/counter.js';
export function App() {
const page =
<>
<Counter label={'Taps'} />
</>;
return (
<Routes>
<Route path={'/*'} element={page} />
</Routes>
);
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment