Skip to content

Commit

Permalink
add no-imports-from-entries rule (#8548)
Browse files Browse the repository at this point in the history
* add no-imports-from-entries rule

* Fixed react-ui build and moved tests to react-ui

* Fixed lint

* Re-fixed lint

* Try to fix react-ui tests

* update package.json

* add     <script src="../../build/survey-core/survey.i18n.min.js"></script>

* Try to fix f-tests

* Try to fix tests

* Try to fix builds

* Try to fix builds

---------

Co-authored-by: OlgaLarina <[email protected]>
Co-authored-by: tsv2013 <[email protected]>
  • Loading branch information
3 people authored Jul 15, 2024
1 parent 78d2a67 commit b3c5ec7
Show file tree
Hide file tree
Showing 28 changed files with 76 additions and 269 deletions.
1 change: 1 addition & 0 deletions .eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
"rules": {
"surveyjs/no-test-only": 2,
"surveyjs/no-test-debug": 2,
"surveyjs/no-imports-from-entries": 2,
"no-console": 2, // Remember, this means error!
"indent": [
"error",
Expand Down
2 changes: 1 addition & 1 deletion accessibilityTests/helper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ export const initSurvey = ClientFunction(
} else if (framework === "react") {
document.getElementById("surveyElement").innerHTML = "";
window["ReactDOM"].render(
window["React"].createElement(window["Survey"].Survey, {
window["React"].createElement(window["SurveyReact"].Survey, {
model: model,
onComplete: surveyComplete,
}),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,6 @@
"skipLibCheck": true
},
"include": [
"../../src/entries/jquery-ui-model.ts"
"../../src/entries/react-ui-model.ts"
],
}
2 changes: 1 addition & 1 deletion build-scripts/survey-ui/tsconfig.typing.ui.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,6 @@
"skipLibCheck": true
},
"include": [
"../../src/entries/jquery-ui-model.ts"
"../../src/entries/react-ui-model.ts"
],
}
9 changes: 9 additions & 0 deletions eslint-surveyjs/index.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
const testOnlyMessage = " :( please don't forget to remove 'test.only' testcafe statement it will disable all other tests :( ";
const debugMessage = " :( please don't forget to remove 'debug()' :( ";
const entriesMessage = "import from 'entries' folder needs to be replaced. Use another path."

module.exports = {
rules: {
Expand All @@ -25,5 +26,13 @@ module.exports = {
}
}
}),
"no-imports-from-entries": context =>
({
ImportDeclaration: function (node) {
if (node.source.value.includes("\/entries\/")) {
context.report(node, entriesMessage);
}
}
}),
}
};
8 changes: 7 additions & 1 deletion examples_test/bootstrap/react.html
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,13 @@
<script src="https://unpkg.com/react@latest/umd/react.production.min.js"></script>
<script src="https://unpkg.com/react-dom@latest/umd/react-dom.production.min.js"></script>
<link rel="stylesheet" href="https://unpkg.com/[email protected]/dist/css/bootstrap.min.css"/>
<script src="../../build/survey-react/survey.react.min.js"></script>
<!-- <link rel="stylesheet" href="../../build/survey-core/survey.min.css" /> -->
<!-- <link rel="stylesheet" href="../../build/survey-core/modern.min.css" /> -->
<!-- <link rel="stylesheet" href="../../build/survey-core/defaultV2.min.css" /> -->
<script src="../../build/survey-core/survey.core.min.js"></script>
<script src="../../build/survey-core/survey.i18n.min.js"></script>
<script src="../../build/survey-core/plugins/bootstrap-integration.min.js"></script>
<script src="../../build/survey-react-ui/survey-react-ui.min.js"></script>
</head>
<body>
<div id="surveyElement"></div>
Expand Down
2 changes: 1 addition & 1 deletion examples_test/bootstrap/survey-ui.html
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

<script src="../../build/survey-core/survey.core.min.js"></script>
<script src="../../build/survey-core/i18n/index.min.js"></script>
<script src="../../build/survey-core/plugins/bootstrap-integration.js"></script>
<script src="../../build/survey-core/plugins/bootstrap-integration.min.js"></script>
<script src="../../build/survey-ui/survey-ui.min.js"></script>
</head>
<body>
Expand Down
8 changes: 6 additions & 2 deletions examples_test/customWidget/react.html
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,12 @@
<script type="text/javascript" src="http://ajax.aspnetcdn.com/ajax/globalize/0.1.1/globalize.min.js"></script>
<script type="text/javascript" src="http://cdn3.devexpress.com/jslib/15.1.5/js/dx.chartjs.js"></script>

<script src="../../build/survey-react/survey.react.min.js"></script>
<link rel="stylesheet" href="../../build/survey-react/survey.min.css" />
<link rel="stylesheet" href="../../build/survey-core/survey.min.css" />
<!-- <link rel="stylesheet" href="../../build/survey-core/modern.min.css" /> -->
<!-- <link rel="stylesheet" href="../../build/survey-core/defaultV2.min.css" /> -->
<script src="../../build/survey-core/survey.core.min.js"></script>
<script src="../../build/survey-core/survey.i18n.min.js"></script>
<script src="../../build/survey-react-ui/survey-react-ui.min.js"></script>
<!-- <link rel="stylesheet" href="https://unpkg.com/[email protected]/dist/css/bootstrap.min.css"> -->

<!-- custom widgets -->
Expand Down
8 changes: 6 additions & 2 deletions examples_test/default/react.html
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,12 @@
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<script src="https://unpkg.com/react@latest/umd/react.production.min.js"></script>
<script src="https://unpkg.com/react-dom@latest/umd/react-dom.production.min.js"></script>
<link rel="stylesheet" href="../../build/survey-react/survey.min.css"/>
<script src="../../build/survey-react/survey.react.min.js"></script>
<link rel="stylesheet" href="../../build/survey-core/survey.min.css" />
<!-- <link rel="stylesheet" href="../../build/survey-core/modern.min.css" /> -->
<!-- <link rel="stylesheet" href="../../build/survey-core/defaultV2.min.css" /> -->
<script src="../../build/survey-core/survey.core.min.js"></script>
<script src="../../build/survey-core/survey.i18n.min.js"></script>
<script src="../../build/survey-react-ui/survey-react-ui.min.js"></script>
<script src="./index.js"></script>
</head>
<body>
Expand Down
8 changes: 6 additions & 2 deletions examples_test/defaultV2/react.html
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,12 @@
<script src="https://cdnjs.cloudflare.com/ajax/libs/showdown/1.6.4/showdown.min.js"></script>
<script src="https://unpkg.com/react@latest/umd/react.production.min.js"></script>
<script src="https://unpkg.com/react-dom@latest/umd/react-dom.production.min.js"></script>
<link rel="stylesheet" href="../../build/survey-react/defaultV2.min.css" />
<script src="../../build/survey-react/survey.react.min.js"></script>
<!-- <link rel="stylesheet" href="../../build/survey-core/survey.min.css" /> -->
<!-- <link rel="stylesheet" href="../../build/survey-core/modern.min.css" /> -->
<link rel="stylesheet" href="../../build/survey-core/defaultV2.min.css" />
<script src="../../build/survey-core/survey.core.min.js"></script>
<script src="../../build/survey-core/survey.i18n.min.js"></script>
<script src="../../build/survey-react-ui/survey-react-ui.min.js"></script>
</head>
<body>
<div id="surveyElement"></div>
Expand Down
8 changes: 6 additions & 2 deletions examples_test/modern/react.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,12 @@
<meta name="viewport" content="width=device-width, initial-scale=1"/>
<script src="https://unpkg.com/react@latest/umd/react.production.min.js"></script>
<script src="https://unpkg.com/react-dom@latest/umd/react-dom.production.min.js"></script>
<link rel="stylesheet" href="../../build/survey-react/modern.min.css"/>
<script src="../../build/survey-react/survey.react.min.js"></script>
<!-- <link rel="stylesheet" href="../../build/survey-core/survey.min.css" /> -->
<link rel="stylesheet" href="../../build/survey-core/modern.min.css" />
<!-- <link rel="stylesheet" href="../../build/survey-core/defaultV2.min.css" /> -->
<script src="../../build/survey-core/survey.core.min.js"></script>
<script src="../../build/survey-core/survey.i18n.min.js"></script>
<script src="../../build/survey-react-ui/survey-react-ui.min.js"></script>
<script src="./index.js"></script>
</head>
<body>
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -145,8 +145,8 @@
"eslint": "^7.32.0",
"eslint-cli": "^1.1.1",
"eslint-plugin-react": "7.30.1",
"eslint-plugin-surveyjs": "file:eslint-surveyjs",
"eslint-plugin-vue": "^9.3.0",
"eslint-plugin-surveyjs": "file:eslint-surveyjs",
"file-loader": "0.10.0",
"generate-json-webpack-plugin": "^1.0.0",
"get-func-name": "2.0.0",
Expand Down
114 changes: 0 additions & 114 deletions src/entries/jquery-ui-model.ts

This file was deleted.

4 changes: 2 additions & 2 deletions src/entries/jquery-ui.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import * as React from "react";
import * as ReactDOM from "react-dom";
import jQuery from "jquery";

import { Survey, PopupSurvey } from "./jquery-ui-model";
import { Survey, PopupSurvey } from "./react-ui-model";

import { SurveyModel, checkLibraryVersion } from "survey-core";

Expand All @@ -29,7 +29,7 @@ SurveyModel.platform = "jquery";

export const preact: any = React;

export * from "./jquery-ui-model";
export * from "./react-ui-model";
export * from "./core-export";

export { SurveyModel as Model } from "survey-core";
Expand Down
3 changes: 0 additions & 3 deletions src/entries/react-ui.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,6 @@ export * from "./react-ui-model";
export * from "./core-export";
export { SurveyModel as Model } from "survey-core";

export * from "../utils/responsivity-manager";
export { unwrap } from "../utils/utils";

import { checkLibraryVersion } from "survey-core";

checkLibraryVersion(`${process.env.VERSION}`, "survey-react-ui");
Loading

0 comments on commit b3c5ec7

Please sign in to comment.