@next/eslint-plugin-next 14.0.3-canary.1 → 14.0.3-canary.11

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -41,13 +41,8 @@ function _interop_require_wildcard(obj, nodeInterop) {
41
41
  return newObj;
42
42
  }
43
43
  var url = "https://nextjs.org/docs/messages/no-before-interactive-script-outside-document";
44
- var startsWithUsingCorrectSeparators = function(str, start) {
45
- return [
46
- _path.sep,
47
- _path.posix.sep
48
- ].some(function(sep) {
49
- return str.startsWith(start.replace(/\//g, sep));
50
- });
44
+ var convertToCorrectSeparator = function(str) {
45
+ return str.replace(/[\\/]/g, _path.sep);
51
46
  };
52
47
  module.exports = (0, _definerule.defineRule)({
53
48
  meta: {
@@ -66,14 +61,10 @@ module.exports = (0, _definerule.defineRule)({
66
61
  scriptImportName = node.local.name;
67
62
  },
68
63
  JSXOpeningElement: function JSXOpeningElement(node) {
69
- var pathname = context.getFilename();
70
- if (startsWithUsingCorrectSeparators(pathname, "src/")) {
71
- pathname = pathname.slice(4);
72
- } else if (startsWithUsingCorrectSeparators(pathname, "/src/")) {
73
- pathname = pathname.slice(5);
74
- }
64
+ var pathname = convertToCorrectSeparator(context.getFilename());
65
+ var isInAppDir = pathname.includes("".concat(_path.sep, "app").concat(_path.sep));
75
66
  // This rule shouldn't fire in `app/`
76
- if (startsWithUsingCorrectSeparators(pathname, "app/") || startsWithUsingCorrectSeparators(pathname, "/app/")) {
67
+ if (isInAppDir) {
77
68
  return;
78
69
  }
79
70
  if (!scriptImportName) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@next/eslint-plugin-next",
3
- "version": "14.0.3-canary.1",
3
+ "version": "14.0.3-canary.11",
4
4
  "description": "ESLint plugin for Next.js.",
5
5
  "main": "dist/index.js",
6
6
  "license": "MIT",