## Issue
The `context.getFilename()` gets the absolute path of the files, and the if statement to filter `/src` and `/app` was not working since #46609.
## Expected
Do not show a lint warning if use `beforeInteractive` inside `appDir`.
Fixes#46609#50261
## Why?
```
src/app/layout.tsx
```
![code](https://github.com/vercel/next.js/assets/120007119/3cc991f8-a96d-4ffb-9f84-4dfdbcac5318)
**eslint[@next/next/no-before-interactive-script-outside-document](https://nextjs.org/docs/messages/no-before-interactive-script-outside-document)**
> `next/script`'s `beforeInteractive` strategy should not be used outside of `pages/_document.js`.
## How?
- Possibility of pathname starts with "/" on OS X and Linux, so added condition to check file path starting with "/"
- e.g. "/src/app" or "/app"
- Added test code
Passed
- `pnpm build && pnpm lint`
- `pnpm jest test/unit/eslint-plugin-next/no-before-interactive-script-outside-document.test.ts`
Extends #46609Fixes#50096
Fixes NEXT-1230
fixes https://github.com/vercel/next.js/issues/46549
The docs are wrong for now, this limitation is just in `pages/`, you can
use it anywhere in `app/`.
Since `app/` is still not stable we will emit that warning in all files
outside of `app/`.
Follow-up on https://github.com/vercel/next.js/pull/38534#pullrequestreview-1035020450
This lets us use modern JS/TS syntax in ESLint rules and avoid issues like #38530 and #36693
## Bug
- [ ] Related issues linked using `fixes #number`
- [ ] Integration tests added
- [ ] Errors have helpful link attached, see `contributing.md`
## Feature
- [ ] Implements an existing feature request or RFC. Make sure the feature request has been accepted for implementation before opening a PR.
- [ ] Related issues linked using `fixes #number`
- [ ] Integration tests added
- [ ] Documentation added
- [ ] Telemetry added. In case of a feature if it's used or not.
- [ ] Errors have helpful link attached, see `contributing.md`
## Documentation / Examples
- [ ] Make sure the linting passes by running `pnpm lint`
- [ ] The examples guidelines are followed from [our contributing doc](https://github.com/vercel/next.js/blob/canary/contributing.md#adding-examples)
Co-authored-by: JJ Kasper <22380829+ijjk@users.noreply.github.com>