Skip to content

Commit bf3f2c7

Browse files
committed
fix(core): exclude external libs in getSourceFiles
1 parent f99967c commit bf3f2c7

File tree

10 files changed

+213
-51
lines changed

10 files changed

+213
-51
lines changed

.prettierrc

+1-4
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,7 @@
1010
}
1111
}
1212
],
13-
"plugins": [
14-
"prettier-plugin-packagejson",
15-
"@ianvs/prettier-plugin-sort-imports"
16-
],
13+
"plugins": ["prettier-plugin-packagejson", "@ianvs/prettier-plugin-sort-imports"],
1714
"importOrder": [
1815
"<BUILTIN_MODULES>",
1916
"<THIRD_PARTY_MODULES>",

docs/src/app/code-of-conduct/page.md

+48
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
# Code of Conduct
2+
3+
As a community of developers, we strive to create a friendly, safe, and welcoming environment for
4+
all, regardless of experience level, gender, gender identity and expression, sexual orientation,
5+
disability, personal appearance, body size, race, ethnicity, age, religion, or nationality.
6+
7+
## Our Standards
8+
9+
Examples of behavior that contributes to creating a positive environment include:
10+
11+
- Using welcoming and inclusive language
12+
- Being respectful of differing viewpoints and experiences
13+
- Gracefully accepting constructive criticism
14+
- Focusing on what is best for the community
15+
- Showing empathy towards other community members
16+
17+
Examples of unacceptable behavior include:
18+
19+
- The use of sexualized language or imagery and unwelcome sexual attention or advances
20+
- Trolling, insulting/derogatory comments, and personal or political attacks
21+
- Public or private harassment
22+
- Publishing others' private information, such as a physical or electronic address, without explicit
23+
permission
24+
- Other conduct which could reasonably be considered inappropriate in a professional setting
25+
26+
## Our Responsibilities
27+
28+
Project maintainers are responsible for clarifying the standards of acceptable behavior and are
29+
expected to take appropriate and fair corrective action in response to any instances of unacceptable
30+
behavior.
31+
32+
## Scope
33+
34+
This Code of Conduct applies both within project spaces and in public spaces when an individual is
35+
representing the project or its community.
36+
37+
## Enforcement
38+
39+
Instances of abusive, harassing, or otherwise unacceptable behavior may be reported by contacting
40+
the project team at [igor@katsuba.dev](mailto:igor@katsuba.dev) . All complaints will be reviewed
41+
and investigated and will result in a response that is deemed necessary and appropriate to the
42+
circumstances.
43+
44+
## Attribution
45+
46+
This Code of Conduct is adapted from the
47+
[Contributor Covenant](https://www.contributor-covenant.org), version 2.0, available at
48+
https://www.contributor-covenant.org/version/2/0/code_of_conduct.html.

docs/src/app/coding-standards/page.md

+53-1
Original file line numberDiff line numberDiff line change
@@ -6,4 +6,56 @@ nextjs:
66
description: 'Learn about the coding standards of `mutates`.'
77
---
88

9-
WIP
9+
# Coding Standards
10+
11+
Welcome to the coding standards for the `mutates` project. This document outlines the guidelines and
12+
best practices for contributing to the codebase.
13+
14+
## General Guidelines
15+
16+
- **Consistency**: Ensure that your code is consistent with the existing codebase.
17+
- **Readability**: Write code that is easy to read and understand.
18+
- **Documentation**: Document your code where necessary, especially for complex logic.
19+
20+
## Code Style
21+
22+
- **Indentation**: Use 2 spaces for indentation.
23+
- **Line Length**: Limit lines to 100 characters.
24+
- **Quotes**: Use single quotes for strings.
25+
- **Semicolons**: Use semicolons at the end of statements.
26+
27+
## TypeScript Specific
28+
29+
- **Types**: Always define types for function parameters and return values.
30+
- **Interfaces**: Prefer interfaces over type aliases for object shapes.
31+
- **Enums**: Use enums for sets of related constants.
32+
33+
## Example
34+
35+
Here is an example of a well-formatted TypeScript function:
36+
37+
```typescript
38+
function greet(name: string): string {
39+
return `Hello, ${name}`;
40+
}
41+
```
42+
43+
## Linting and Formatting
44+
45+
We use ESLint and Prettier to enforce code style and formatting. Ensure that your code passes all
46+
linting checks before submitting a pull request.
47+
48+
## Commit Messages
49+
50+
Follow the [Conventional Commits](https://www.conventionalcommits.org/) specification for commit
51+
messages. This helps in automating the release process and generating changelogs.
52+
53+
## Additional Resources
54+
55+
For more detailed guidelines, refer to the following documents:
56+
57+
- [Contribution Guide](/contribution-guide)
58+
- [Frequently Asked Questions](/frequently-asked-questions)
59+
- [Troubleshooting](/troubleshooting)
60+
61+
Thank you for contributing to `mutates`!

docs/src/app/contribution-guide/page.md

+81-1
Original file line numberDiff line numberDiff line change
@@ -6,4 +6,84 @@ nextjs:
66
description: How to contribute to the Mutates project.
77
---
88

9-
WIP
9+
# Contributing to Mutates
10+
11+
We're thrilled that you're interested in contributing to Mutates! This document provides guidelines
12+
and information about how to contribute to our project.
13+
14+
## Getting Started
15+
16+
1. Fork the repository on GitHub.
17+
2. Clone your fork locally:
18+
```bash
19+
git clone https://github.com/your-username/mutates.git
20+
cd mutates
21+
```
22+
3. Install dependencies:
23+
```bash
24+
npm install
25+
```
26+
4. Create a branch for your contribution:
27+
```bash
28+
git checkout -b feature/your-feature-name
29+
```
30+
31+
## Development Workflow
32+
33+
1. Make your changes in the appropriate package(s).
34+
2. Write or update tests for your changes.
35+
3. Ensure all tests pass:
36+
```bash
37+
nx affected --target=test
38+
```
39+
4. Update documentation if necessary.
40+
5. Commit your changes with a clear and descriptive commit message.
41+
42+
## Pull Request Process
43+
44+
1. Push your changes to your fork on GitHub.
45+
2. Open a pull request against the `main` branch of the Mutates repository.
46+
3. Ensure your PR description clearly describes the problem and solution.
47+
4. Link any relevant issues in the PR description.
48+
5. Wait for review from maintainers.
49+
50+
## Coding Standards
51+
52+
- Follow the existing code style in the project.
53+
- Use TypeScript for new code.
54+
- Write clear, self-documenting code with appropriate comments where necessary.
55+
- Ensure your code passes linting:
56+
```bash
57+
nx affected --target=lint
58+
```
59+
60+
## Testing
61+
62+
- Write unit tests for new functionality.
63+
- Ensure all existing tests pass before submitting a PR.
64+
- Aim for high test coverage for new code.
65+
66+
## Documentation
67+
68+
- Update relevant documentation for any new features or changes.
69+
- Use clear and concise language in documentation.
70+
- Include code examples where appropriate.
71+
72+
## Reporting Issues
73+
74+
- Use the GitHub issue tracker to report bugs or suggest features.
75+
- Clearly describe the issue, including steps to reproduce for bugs.
76+
- Check if the issue has already been reported before creating a new one.
77+
78+
## Community and Conduct
79+
80+
- Be respectful and inclusive in all interactions.
81+
- Follow our [Code of Conduct](CODE_OF_CONDUCT.md).
82+
- Help others in the community when you can.
83+
84+
## Questions?
85+
86+
If you have any questions about contributing, feel free to open an issue for discussion or reach out
87+
to the maintainers directly.
88+
89+
Thank you for contributing to Mutates! Your efforts help make this project better for everyone.

docs/src/app/not-found.tsx

+4-9
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,20 @@
1-
import Link from 'next/link'
1+
import Link from 'next/link';
22

33
export default function NotFound() {
44
return (
55
<div className="min-w-0 max-w-2xl flex-auto px-4 py-16 lg:max-w-none lg:pl-8 lg:pr-0 xl:px-16">
66
<div className="flex h-full flex-col items-center justify-center text-center">
7-
<p className="font-display text-sm font-medium text-slate-900 dark:text-white">
8-
404
9-
</p>
7+
<p className="font-display text-sm font-medium text-slate-900 dark:text-white">404</p>
108
<h1 className="mt-3 font-display text-3xl tracking-tight text-slate-900 dark:text-white">
119
Page not found
1210
</h1>
1311
<p className="mt-2 text-sm text-slate-500 dark:text-slate-400">
1412
Sorry, we couldn’t find the page you’re looking for.
1513
</p>
16-
<Link
17-
href="/"
18-
className="mt-8 text-sm font-medium text-slate-900 dark:text-white"
19-
>
14+
<Link href="/" className="mt-8 text-sm font-medium text-slate-900 dark:text-white">
2015
Go back home
2116
</Link>
2217
</div>
2318
</div>
24-
)
19+
);
2520
}

docs/src/app/providers.tsx

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
1-
'use client'
1+
'use client';
22

3-
import { ThemeProvider } from 'next-themes'
3+
import { ThemeProvider } from 'next-themes';
44

55
export function Providers({ children }: { children: React.ReactNode }) {
66
return (
77
<ThemeProvider attribute="class" disableTransitionOnChange>
88
{children}
99
</ThemeProvider>
10-
)
10+
);
1111
}

docs/src/components/Button.tsx

+8-12
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,26 @@
1-
import Link from 'next/link'
2-
import clsx from 'clsx'
1+
import clsx from 'clsx';
2+
import Link from 'next/link';
33

44
const variantStyles = {
55
primary:
66
'rounded-full bg-sky-300 py-2 px-4 text-sm font-semibold text-slate-900 hover:bg-sky-200 focus:outline-none focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-sky-300/50 active:bg-sky-500',
77
secondary:
88
'rounded-full bg-slate-800 py-2 px-4 text-sm font-medium text-white hover:bg-slate-700 focus:outline-none focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-white/50 active:text-slate-400',
9-
}
9+
};
1010

1111
type ButtonProps = {
12-
variant?: keyof typeof variantStyles
12+
variant?: keyof typeof variantStyles;
1313
} & (
1414
| React.ComponentPropsWithoutRef<typeof Link>
1515
| (React.ComponentPropsWithoutRef<'button'> & { href?: undefined })
16-
)
16+
);
1717

18-
export function Button({
19-
variant = 'primary',
20-
className,
21-
...props
22-
}: ButtonProps) {
23-
className = clsx(variantStyles[variant], className)
18+
export function Button({ variant = 'primary', className, ...props }: ButtonProps) {
19+
className = clsx(variantStyles[variant], className);
2420

2521
return typeof props.href === 'undefined' ? (
2622
<button className={className} {...props} />
2723
) : (
2824
<Link className={className} {...props} />
29-
)
25+
);
3026
}

docs/src/components/Fence.tsx

+6-16
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,11 @@
1-
'use client'
1+
'use client';
22

3-
import { Fragment } from 'react'
4-
import { Highlight } from 'prism-react-renderer'
3+
import { Highlight } from 'prism-react-renderer';
4+
import { Fragment } from 'react';
55

6-
export function Fence({
7-
children,
8-
language,
9-
}: {
10-
children: string
11-
language: string
12-
}) {
6+
export function Fence({ children, language }: { children: string; language: string }) {
137
return (
14-
<Highlight
15-
code={children.trimEnd()}
16-
language={language}
17-
theme={{ plain: {}, styles: [] }}
18-
>
8+
<Highlight code={children.trimEnd()} language={language} theme={{ plain: {}, styles: [] }}>
199
{({ className, style, tokens, getTokenProps }) => (
2010
<pre className={className} style={style}>
2111
<code>
@@ -33,5 +23,5 @@ export function Fence({
3323
</pre>
3424
)}
3525
</Highlight>
36-
)
26+
);
3727
}

docs/src/components/Logo.tsx

+3-3
Original file line numberDiff line numberDiff line change
@@ -4,15 +4,15 @@ function LogomarkPaths() {
44
<path d="M10.308 5L18 17.5 10.308 30 2.615 17.5 10.308 5z" />
55
<path d="M18 17.5L10.308 5h15.144l7.933 12.5M18 17.5h15.385L25.452 30H10.308L18 17.5z" />
66
</g>
7-
)
7+
);
88
}
99

1010
export function Logomark(props: React.ComponentPropsWithoutRef<'svg'>) {
1111
return (
1212
<svg aria-hidden="true" viewBox="0 0 36 36" fill="none" {...props}>
1313
<LogomarkPaths />
1414
</svg>
15-
)
15+
);
1616
}
1717

1818
export function Logo(props: React.ComponentPropsWithoutRef<'svg'>) {
@@ -21,5 +21,5 @@ export function Logo(props: React.ComponentPropsWithoutRef<'svg'>) {
2121
<LogomarkPaths />
2222
<path d="M55.96 26.2c-1.027 0-1.973-.173-2.84-.52a6.96 6.96 0 01-2.24-1.5 6.979 6.979 0 01-1.46-2.3c-.347-.893-.52-1.867-.52-2.92 0-1.027.18-1.973.54-2.84a6.71 6.71 0 011.52-2.28 6.922 6.922 0 012.3-1.52 7.48 7.48 0 012.86-.54c.667 0 1.32.093 1.96.28a6.12 6.12 0 011.78.78 5.7 5.7 0 011.4 1.24l-1.88 2.08a6.272 6.272 0 00-1-.82 3.728 3.728 0 00-1.08-.54 3.542 3.542 0 00-1.2-.2 4.14 4.14 0 00-1.62.32 3.991 3.991 0 00-1.3.9 4.197 4.197 0 00-.9 1.38 4.755 4.755 0 00-.32 1.78c0 .667.107 1.273.32 1.82.213.533.513.993.9 1.38.387.373.847.667 1.38.88.547.2 1.147.3 1.8.3a4.345 4.345 0 002.34-.68c.347-.213.653-.46.92-.74l1.46 2.34c-.32.36-.753.687-1.3.98a7.784 7.784 0 01-1.8.7c-.667.16-1.34.24-2.02.24zm6.99-.2l5.48-14h2.68l5.46 14h-3.08l-2.82-7.54c-.08-.213-.18-.487-.3-.82a922.595 922.595 0 00-.68-2.12 13.694 13.694 0 01-.24-.86l.54-.02c-.08.307-.174.627-.28.96-.094.32-.194.653-.3 1-.108.333-.22.66-.34.98-.12.32-.234.633-.34.94L65.91 26h-2.96zm2.54-2.94l.98-2.42h6.42l1 2.42h-8.4zm19.794 3.14c-1.026 0-1.973-.173-2.84-.52a6.96 6.96 0 01-2.24-1.5 6.98 6.98 0 01-1.46-2.3c-.346-.893-.52-1.867-.52-2.92 0-1.027.18-1.973.54-2.84a6.71 6.71 0 011.52-2.28 6.923 6.923 0 012.3-1.52 7.48 7.48 0 012.86-.54c.667 0 1.32.093 1.96.28a6.118 6.118 0 011.78.78c.547.347 1.014.76 1.4 1.24l-1.88 2.08a6.272 6.272 0 00-1-.82 3.728 3.728 0 00-1.08-.54 3.542 3.542 0 00-1.2-.2 4.14 4.14 0 00-1.62.32 3.992 3.992 0 00-1.3.9 4.197 4.197 0 00-.9 1.38 4.755 4.755 0 00-.32 1.78c0 .667.107 1.273.32 1.82.214.533.514.993.9 1.38.387.373.847.667 1.38.88.547.2 1.147.3 1.8.3a4.345 4.345 0 002.34-.68 4.53 4.53 0 00.92-.74l1.46 2.34c-.32.36-.753.687-1.3.98a7.784 7.784 0 01-1.8.7c-.666.16-1.34.24-2.02.24zm17.469-.2V12h3v14h-3zm-8.82 0V12h3v14h-3zm1.2-5.62l.02-2.72h9.14v2.72h-9.16zM110.402 26V12h9.46v2.64h-6.54v8.72h6.68V26h-9.6zm1.4-5.86v-2.56h7.1v2.56h-7.1zM122.437 26l5.48-14h2.68l5.46 14h-3.08l-2.82-7.54c-.08-.213-.18-.487-.3-.82l-.34-1.06-.34-1.06a14.73 14.73 0 01-.24-.86l.54-.02c-.08.307-.173.627-.28.96a63.3 63.3 0 01-.3 1c-.106.333-.22.66-.34.98-.12.32-.233.633-.34.94l-2.82 7.48h-2.96zm2.54-2.94l.98-2.42h6.42l1 2.42h-8.4zM139.023 26V12h5.74c1.027 0 1.953.173 2.78.52.84.333 1.56.813 2.16 1.44a6.097 6.097 0 011.4 2.2c.32.853.48 1.8.48 2.84 0 1.027-.16 1.973-.48 2.84a6.438 6.438 0 01-1.38 2.22 6.394 6.394 0 01-2.16 1.44c-.84.333-1.773.5-2.8.5h-5.74zm3-2.18l-.32-.52h2.96c.6 0 1.14-.1 1.62-.3.48-.213.887-.5 1.22-.86.347-.373.607-.827.78-1.36.173-.533.26-1.127.26-1.78a5.56 5.56 0 00-.26-1.76 3.595 3.595 0 00-.78-1.36 3.323 3.323 0 00-1.22-.86 3.948 3.948 0 00-1.62-.32h-3.02l.38-.48v9.6zM158.671 26l-5.58-14h3.18l2.92 7.58c.16.413.293.78.4 1.1.12.307.22.6.3.88.093.267.18.533.26.8.08.253.16.533.24.84l-.58.02c.107-.413.213-.793.32-1.14.107-.36.227-.733.36-1.12.133-.387.3-.847.5-1.38l2.76-7.58h3.16l-5.62 14h-2.62zm8.114 0l5.48-14h2.68l5.46 14h-3.08l-2.82-7.54c-.08-.213-.18-.487-.3-.82l-.34-1.06-.34-1.06a13.293 13.293 0 01-.24-.86l.54-.02c-.08.307-.173.627-.28.96a63.3 63.3 0 01-.3 1c-.107.333-.22.66-.34.98-.12.32-.233.633-.34.94l-2.82 7.48h-2.96zm2.54-2.94l.98-2.42h6.42l1 2.42h-8.4zM183.371 26V12h2.68l7.74 10.46h-.56c-.054-.413-.1-.813-.14-1.2l-.12-1.2c-.027-.413-.054-.833-.08-1.26-.014-.44-.027-.9-.04-1.38a56.825 56.825 0 01-.02-1.6V12h2.94v14h-2.72l-7.9-10.56.76.02c.066.693.12 1.287.16 1.78a36.623 36.623 0 01.18 2.2c.026.267.04.52.04.76.013.24.02.493.02.76V26h-2.94zm23.175.2c-1.027 0-1.973-.173-2.84-.52-.853-.36-1.6-.86-2.24-1.5a6.979 6.979 0 01-1.46-2.3c-.347-.893-.52-1.867-.52-2.92 0-1.027.18-1.973.54-2.84a6.71 6.71 0 011.52-2.28 6.919 6.919 0 012.3-1.52 7.48 7.48 0 012.86-.54c.667 0 1.32.093 1.96.28a6.12 6.12 0 011.78.78 5.7 5.7 0 011.4 1.24l-1.88 2.08a6.259 6.259 0 00-1-.82 3.721 3.721 0 00-1.08-.54 3.54 3.54 0 00-1.2-.2 4.14 4.14 0 00-1.62.32 3.991 3.991 0 00-1.3.9 4.206 4.206 0 00-.9 1.38 4.76 4.76 0 00-.32 1.78c0 .667.107 1.273.32 1.82.213.533.513.993.9 1.38.387.373.847.667 1.38.88.547.2 1.147.3 1.8.3a4.35 4.35 0 002.34-.68c.347-.213.653-.46.92-.74l1.46 2.34c-.32.36-.753.687-1.3.98a7.773 7.773 0 01-1.8.7c-.667.16-1.34.24-2.02.24zm8.649-.2V12h9.46v2.64h-6.54v8.72h6.68V26h-9.6zm1.4-5.86v-2.56h7.1v2.56h-7.1z" />
2323
</svg>
24-
)
24+
);
2525
}

packages/core/src/lib/source-file/get-source-files.ts

+6-2
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,13 @@ import { getActiveProject } from '../project';
44
import { Pattern } from '../utils';
55

66
export function getSourceFiles(pattern?: Pattern): SourceFile[] {
7-
return getActiveProject().getSourceFiles(pattern as string);
7+
return getActiveProject()
8+
.getSourceFiles(pattern as string)
9+
.filter((file) => !file.isFromExternalLibrary());
810
}
911

1012
export function getSourceFile(filePath: string): SourceFile | null {
11-
return getActiveProject().getSourceFile(filePath) ?? null;
13+
const file = getActiveProject().getSourceFile(filePath);
14+
15+
return file && !file.isFromExternalLibrary() ? file : null;
1216
}

0 commit comments

Comments
 (0)