diff --git a/.eslintrc.json b/.eslintrc.json index 68b3aefbe5..02d5362142 100644 --- a/.eslintrc.json +++ b/.eslintrc.json @@ -26,6 +26,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", diff --git a/eslint-surveyjs/index.js b/eslint-surveyjs/index.js index b85fe32c75..92c5438469 100644 --- a/eslint-surveyjs/index.js +++ b/eslint-surveyjs/index.js @@ -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: { @@ -23,5 +24,13 @@ module.exports = { } } }), + "no-imports-from-entries": context => + ({ + ImportDeclaration: function (node) { + if (node.source.value.includes("\/entries\/")) { + context.report(node, entriesMessage); + } + } + }), } }; \ No newline at end of file diff --git a/package.json b/package.json index be006eb3c8..f9bb85827c 100644 --- a/package.json +++ b/package.json @@ -21,8 +21,8 @@ "devextreme-screenshot-comparer": "^2.0.11", "eslint": "^7.32.0", "eslint-cli": "^1.1.1", - "eslint-plugin-react": "^7.25.1", "eslint-plugin-surveyjs": "file:eslint-surveyjs", + "eslint-plugin-react": "^7.25.1", "husky": "^7.0.4", "testcafe": "3.3.0", "get-func-name": "2.0.0",