Skip to content

Commit

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

* update package.json

---------

Co-authored-by: OlgaLarina <[email protected]>
  • Loading branch information
OlgaLarina and OlgaLarina authored Jul 15, 2024
1 parent 16a6b8b commit fc80291
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 1 deletion.
1 change: 1 addition & 0 deletions .eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
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 @@ -23,5 +24,13 @@ module.exports = {
}
}
}),
"no-imports-from-entries": context =>
({
ImportDeclaration: function (node) {
if (node.source.value.includes("\/entries\/")) {
context.report(node, entriesMessage);
}
}
}),
}
};
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down

0 comments on commit fc80291

Please sign in to comment.