Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Vite conversion #58

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
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
92 changes: 82 additions & 10 deletions .eslintrc
Original file line number Diff line number Diff line change
@@ -1,19 +1,91 @@
{
"env": {},
"extends": ["airbnb", "plugin:jest/recommended"],
"parserOptions": {
"ecmaVersion": 2022,
"sourceType": "module",
"ecmaFeatures": {
"jsx": true
}
},
"extends": [
"airbnb",
"plugin:react/recommended",
"plugin:react-hooks/recommended",
"plugin:testing-library/react"
],
"globals": {
"document": true
"page": true,
"document": true,
"vi": true
},
"parser": "@babel/eslint-parser",
"plugins": ["babel", "jest", "react", "react-hooks"],
"plugins": [
"react",
"react-hooks",
"testing-library"
],
"rules": {
"import/no-unresolved": [
2, { "ignore": ["test-utils"] }
],
"import/prefer-default-export": "off",
"import/no-extraneous-dependencies": "off",
"no-console": "off",
"no-unused-expressions": ["error", { "allowShortCircuit": true, "allowTernary": true }],
"no-unused-vars": "off",
"no-undef": "off",
"no-restricted-syntax": ["warn", "WithStatement"],
"no-restricted-globals": ["error"],
"eqeqeq": ["warn", "smart"],
"no-use-before-define": [
"warn",
{
"functions": false,
"classes": false,
"variables": false
},
],
"no-mixed-operators": [
"warn",
{
"groups": [
["&", "|", "^", "~", "<<", ">>", ">>>"],
["==", "!=", "===", "!==", ">", ">=", "<", "<="],
["&&", "||"],
["in", "instanceof"],
],
"allowSamePrecedence": false,
},
],
"react/jsx-filename-extension": [1, { "extensions": [".js", ".jsx"] }],
"react/jsx-fragments": "off",
"react/jsx-props-no-spreading": "off",
"no-underscore-dangle": "off",
"react/prefer-stateless-function": "off",
"react/function-component-definition": "off"
"sort-keys": ["error", "asc", {
"caseSensitive": false,
"natural": false
}],
"react/jsx-props-no-spreading": "off",
"react/function-component-definition": "off",
"default-param-last": "off",
"arrow-parens": "off",
"import/no-anonymous-default-export": "off",
"import/no-extraneous-dependencies": "off",
"max-len": ["error", {
"code": 120,
"ignoreComments": true,
"ignoreStrings": true,
"ignoreTemplateLiterals": true,
"ignoreRegExpLiterals": true
}],
"react/jsx-uses-react": "off",
"react/react-in-jsx-scope": "off",
"react/require-default-props": [2, {
"functions": "defaultArguments"
}],
"react-hooks/exhaustive-deps": "error",
"testing-library/render-result-naming-convention": "off",
"testing-library/no-render-in-lifecycle": [
"error",
{
"allowTestingFrameworkSetupHook": "beforeEach"
}
]
}
}
}
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
/coverage
/demo/dist
/dist
/es
/lib
/node_modules
Expand Down
6 changes: 3 additions & 3 deletions __tests__/MiradorImageTools.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,13 @@ import { TestableImageTools as MiradorImageTools } from '../src/plugins/MiradorI

const mockPalette = {
palette: {
shades: { main: 'rgb(255, 255, 255)' },
getContrastText: () => 'rgb(0, 0, 0)',
shades: { main: 'rgb(255, 255, 255)' },
},
};

jest.mock('@custom-react-hooks/use-element-size', () => ({
useElementSize: () => ([undefined, { width: 100, height: 200 }]),
vi.mock('@custom-react-hooks/use-element-size', () => ({
useElementSize: () => [undefined, { height: 200, width: 100 }],
}));

function createWrapper(props) {
Expand Down
93 changes: 0 additions & 93 deletions babel.config.js

This file was deleted.

1 change: 1 addition & 0 deletions demo/src/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@

<body>
<div id="demo"></div>
<script src="./index.js" type="module"></script>
</body>

</html>
10 changes: 5 additions & 5 deletions demo/src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,18 +3,18 @@ import { miradorImageToolsPlugin } from '../../src';

const config = {
id: 'demo',
windows: [{
imageToolsEnabled: true,
imageToolsOpen: true,
manifestId: 'https://purl.stanford.edu/sn904cj3429/iiif/manifest',
}],
theme: {
palette: {
primary: {
main: '#1967d2',
},
},
},
windows: [{
imageToolsEnabled: true,
imageToolsOpen: true,
manifestId: 'https://purl.stanford.edu/sn904cj3429/iiif/manifest',
}],
};

Mirador.viewer(config, [
Expand Down
21 changes: 0 additions & 21 deletions jest.config.js

This file was deleted.

9 changes: 9 additions & 0 deletions netlify.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# This is the configuration file for the netlify preview deploys
# See https://www.netlify.com/docs/netlify-toml-reference/ for more

[build]
publish = "dist/"

[[redirects]]
from = "/"
to = "/demo/src/"
Loading
Loading