Skip to content

Improve code formatting for consistency #388

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,11 @@ indent_style = tab
insert_final_newline = true
trim_trailing_whitespace = true

# Markdown files should not trim trailing whitespace
[*.md]
trim_trailing_whitespace = false

# JSON and YAML files should use 2 spaces for indentation
[*.{json,yaml,yml}]
indent_size = 2
indent_style = space
14 changes: 10 additions & 4 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -1,7 +1,13 @@
/.codacy-coverage/
/coverage/
/dist/
/types/
# Ignore coverage directories
.codacy-coverage/
coverage/

# Ignore build output
dist/

# Ignore type definitions
types/

# Ignore package files
package.json
package-lock.json
7 changes: 7 additions & 0 deletions .prettierrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"useTabs": true,
"tabWidth": 4,
"singleQuote": true,
"trailingComma": "all",
"printWidth": 80
}
5 changes: 5 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"githubPullRequests.ignoredPullRequestBranches": [
"master"
]
}
12 changes: 6 additions & 6 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,19 +4,19 @@ First of all, thanks for taking the time to contribute to metadata-filter!

## Submitting issues

- Ensure the bug was not already reported by searching on GitHub under issues.
- If you're unable to find an open issue addressing the problem, open a new one.
- Ensure the bug was not already reported by searching on GitHub under issues.
- If you're unable to find an open issue addressing the problem, open a new one.
Be sure to include a title and clear description, as much relevant information as possible.

If you don't know how to report bugs effectively, please use [this article][report-bugs] as a guideline.

## Submitting pull requests

- Fork the metadata-filter [git repository][repository].
- Create a pull request against the [**master**][repository-master] branch.
- Ensure the PR description **clearly** describes the problem and solution.
- Fork the metadata-filter [git repository][repository].
- Create a pull request against the [**master**][repository-master] branch.
- Ensure the PR description **clearly** describes the problem and solution.
Include the relevant issue number(s) if applicable.
- Ensure CI tests pass.
- Ensure CI tests pass.

It's worth reading [how to write][commit-messages] good commit messages.

Expand Down
34 changes: 17 additions & 17 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ object:
```html
<!-- Assume you have `metadata-filter` module included with `script` tag -->
<script lang="javascript">
MetadataFilter.removeRemastered(yourInput);
MetadataFilter.removeRemastered(yourInput);
</script>
```

Expand All @@ -54,9 +54,9 @@ combined fields ("Artist - Song", "Artist - Album"), as in the third example bel
console.log(MetadataFilter.removeRemastered('Jane Doe (Remastered)')); // Jane Doe
console.log(MetadataFilter.removeVersion('Get Lucky (Album Version)')); // Get Lucky
console.log(
MetadataFilter.youtube(
'Car Bomb - Scattered Sprites (Official Music Video)'
)
MetadataFilter.youtube(
'Car Bomb - Scattered Sprites (Official Music Video)'
)
); // Car Bomb - Scattered Sprites
```

Expand All @@ -73,16 +73,16 @@ fields.

```javascript
const filterSet = {
track: [
MetadataFilter.removeRemastered,
MetadataFilter.fixTrackSuffix,
MetadataFilter.removeLive,
],
album: [
MetadataFilter.removeRemastered,
MetadataFilter.fixTrackSuffix,
MetadataFilter.removeLive,
],
track: [
MetadataFilter.removeRemastered,
MetadataFilter.fixTrackSuffix,
MetadataFilter.removeLive,
],
album: [
MetadataFilter.removeRemastered,
MetadataFilter.fixTrackSuffix,
MetadataFilter.removeLive,
],
};
```

Expand Down Expand Up @@ -117,7 +117,7 @@ filter.extend(MetadataFilter.createAmazonFilter());
// This would also work: filter.extend(MetadataFilter.createFilter(filterSet));

console.log(
filter.filterField('track', 'Seasons in the Abyss (Album Version)')
filter.filterField('track', 'Seasons in the Abyss (Album Version)')
); // Seasons in the Abyss
```

Expand All @@ -134,7 +134,7 @@ Since these methods return a `MetadataFilter` instance, you can chain method cal

```javascript
const filter = MetadataFilter.createFilter({ track: filterTrack }).append({
artist: filterArtist,
artist: filterArtist,
});
```

Expand Down Expand Up @@ -162,7 +162,7 @@ const filter = MetadataFilter.createFilter({ track: filterTrack }).append({

## See also

- [music-metadata-filter] - Python implementation of this module
- [music-metadata-filter] - Python implementation of this module

## License

Expand Down
102 changes: 51 additions & 51 deletions src/filters.ts
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
import { MetadataFilter } from './filter';
import {
albumArtistFromArtist,
decodeHtmlEntities,
fixTrackSuffix,
normalizeFeature,
removeCleanExplicit,
removeFeature,
removeLive,
removeParody,
removeReissue,
removeRemastered,
removeVersion,
youtube,
albumArtistFromArtist,

Check failure on line 3 in src/filters.ts

View workflow job for this annotation

GitHub Actions / Run linters

Expected indentation of 1 tab but found 4 spaces
decodeHtmlEntities,

Check failure on line 4 in src/filters.ts

View workflow job for this annotation

GitHub Actions / Run linters

Expected indentation of 1 tab but found 4 spaces
fixTrackSuffix,

Check failure on line 5 in src/filters.ts

View workflow job for this annotation

GitHub Actions / Run linters

Expected indentation of 1 tab but found 4 spaces
normalizeFeature,

Check failure on line 6 in src/filters.ts

View workflow job for this annotation

GitHub Actions / Run linters

Expected indentation of 1 tab but found 4 spaces
removeCleanExplicit,

Check failure on line 7 in src/filters.ts

View workflow job for this annotation

GitHub Actions / Run linters

Expected indentation of 1 tab but found 4 spaces
removeFeature,

Check failure on line 8 in src/filters.ts

View workflow job for this annotation

GitHub Actions / Run linters

Expected indentation of 1 tab but found 4 spaces
removeLive,

Check failure on line 9 in src/filters.ts

View workflow job for this annotation

GitHub Actions / Run linters

Expected indentation of 1 tab but found 4 spaces
removeParody,

Check failure on line 10 in src/filters.ts

View workflow job for this annotation

GitHub Actions / Run linters

Expected indentation of 1 tab but found 4 spaces
removeReissue,

Check failure on line 11 in src/filters.ts

View workflow job for this annotation

GitHub Actions / Run linters

Expected indentation of 1 tab but found 4 spaces
removeRemastered,

Check failure on line 12 in src/filters.ts

View workflow job for this annotation

GitHub Actions / Run linters

Expected indentation of 1 tab but found 4 spaces
removeVersion,
youtube,
} from './functions';

/**
Expand All @@ -20,7 +20,7 @@
* @return Filter object
*/
export function createYouTubeFilter(): MetadataFilter {
return new MetadataFilter({ track: youtube });
return new MetadataFilter({ track: youtube });
}

/**
Expand All @@ -29,10 +29,10 @@
* @return Filter object
*/
export function createRemasteredFilter(): MetadataFilter {
return new MetadataFilter({
track: removeRemastered,
album: removeRemastered,
});
return new MetadataFilter({
track: removeRemastered,
album: removeRemastered,
});
}

/**
Expand All @@ -41,16 +41,16 @@
* @return Filter object
*/
export function createSpotifyFilter(): MetadataFilter {
return new MetadataFilter({
track: [removeRemastered, removeParody, fixTrackSuffix, removeLive],
album: [
removeRemastered,
fixTrackSuffix,
removeLive,
removeReissue,
removeVersion,
],
});
return new MetadataFilter({
track: [removeRemastered, removeParody, fixTrackSuffix, removeLive],
album: [
removeRemastered,
fixTrackSuffix,
removeLive,
removeReissue,
removeVersion,
],
});
}

/**
Expand All @@ -59,26 +59,26 @@
* @return Filter object
*/
export function createAmazonFilter(): MetadataFilter {
return new MetadataFilter({
artist: [normalizeFeature],
track: [
removeCleanExplicit,
removeFeature,
removeRemastered,
fixTrackSuffix,
removeVersion,
removeLive,
],
album: [
decodeHtmlEntities,
removeCleanExplicit,
removeRemastered,
fixTrackSuffix,
removeVersion,
removeLive,
],
albumArtist: [normalizeFeature, albumArtistFromArtist],
});
return new MetadataFilter({
artist: [normalizeFeature],
track: [
removeCleanExplicit,
removeFeature,
removeRemastered,
fixTrackSuffix,
removeVersion,
removeLive,
],
album: [
decodeHtmlEntities,
removeCleanExplicit,
removeRemastered,
fixTrackSuffix,
removeVersion,
removeLive,
],
albumArtist: [normalizeFeature, albumArtistFromArtist],
});
}

/**
Expand All @@ -87,8 +87,8 @@
* @return Filter object
*/
export function createTidalFilter(): MetadataFilter {
return new MetadataFilter({
track: [removeRemastered, fixTrackSuffix, removeVersion, removeLive],
album: [removeRemastered, fixTrackSuffix, removeVersion, removeLive],
});
return new MetadataFilter({
track: [removeRemastered, fixTrackSuffix, removeVersion, removeLive],
album: [removeRemastered, fixTrackSuffix, removeVersion, removeLive],
});
}
Loading
Loading