Skip to content

Commit

Permalink
Merge pull request #1606 from mightyiam/prettier
Browse files Browse the repository at this point in the history
prettier
  • Loading branch information
mightyiam authored Jun 15, 2024
2 parents e49b016 + a6a372b commit f02f695
Show file tree
Hide file tree
Showing 18 changed files with 602 additions and 345 deletions.
1 change: 1 addition & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/CHANGELOG.md
3 changes: 3 additions & 0 deletions .prettierrc.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
semi: false
singleQuote: true
trailingComma: all
12 changes: 6 additions & 6 deletions .releaserc.yml
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
branches:
- main
plugins:
- - "@semantic-release/commit-analyzer"
- - '@semantic-release/commit-analyzer'
- preset: conventionalcommits
- - "@semantic-release/release-notes-generator"
- - '@semantic-release/release-notes-generator'
- preset: conventionalcommits
presetConfig:
types:
Expand All @@ -21,10 +21,10 @@ plugins:
section: Refactoring
- type: test
section: Testing
- "@semantic-release/changelog"
- "@semantic-release/github"
- "@semantic-release/npm"
- - "@semantic-release/git"
- '@semantic-release/changelog'
- '@semantic-release/github'
- '@semantic-release/npm'
- - '@semantic-release/git'
- assets:
- CHANGELOG.md
- package-lock.json
Expand Down
1 change: 0 additions & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,4 +23,3 @@ There's a list of not yet considered rules in [this test file](./src/test/rules-
Pick one — perhaps the first one — and consider it.
Is it appropriate for this config?
If so, [suggest](https://github.com/mightyiam/eslint-config-love/discussions) adding it.

5 changes: 2 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@ Here is an example `eslint.config.cjs`.
module.exports = [
{
...require('eslint-config-love'),
files: [ '**/*.js', '**/*.ts' ],
}
files: ['**/*.js', '**/*.ts'],
},
]
```

Expand All @@ -41,7 +41,6 @@ Read about the `project` option [here](https://github.com/typescript-eslint/type

There are [some more `parserOptions`](https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/parser/README.md#configuration) you may care about.


## Example command line usage:

```
Expand Down
2 changes: 1 addition & 1 deletion commitlint.config.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
module.exports = {
extends: ['@commitlint/config-conventional'],
'type-enum': ['feat', 'fix', 'style', 'refactor', 'test', 'revert', 'build']
'type-enum': ['feat', 'fix', 'style', 'refactor', 'test', 'revert', 'build'],
}
18 changes: 7 additions & 11 deletions eslint.config.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -3,24 +3,20 @@ const tseslint = require('typescript-eslint')
module.exports = [
require('.'),
{
files: [
'**/*.cjs',
'**/*.js',
'**/*.ts'
],
files: ['**/*.cjs', '**/*.js', '**/*.ts'],
linterOptions: {
reportUnusedDisableDirectives: 'error'
}
reportUnusedDisableDirectives: 'error',
},
},
{
files: ['eslint.config.cjs'],
rules: {
...tseslint.configs.disableTypeChecked.rules,
'@typescript-eslint/no-var-requires': 'off'
'@typescript-eslint/no-var-requires': 'off',
},
languageOptions: { parserOptions: { project: false } }
languageOptions: { parserOptions: { project: false } },
},
{
ignores: ['lib/']
}
ignores: ['lib/'],
},
]
16 changes: 16 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 4 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,11 @@
"scripts": {
"compile": "tsc",
"lint": "eslint .",
"format/check": "prettier . --check",
"format/fix": "prettier . --write",
"editorconfig": "editorconfig-checker",
"unit": "ava",
"test": "run-s clean-artifacts editorconfig compile lint unit",
"test": "run-s clean-artifacts format/check editorconfig compile lint unit",
"clean-artifacts": "git clean lib -X --force",
"is-code-clean": "git diff-index HEAD --quiet",
"prepublishOnly": "run-s is-code-clean test"
Expand Down Expand Up @@ -78,6 +80,7 @@
"lodash": "4.17.21",
"npm-package-arg": "11.0.2",
"npm-run-all": "4.1.5",
"prettier": "3.3.2",
"read-pkg-up": "11.0.0",
"runtypes": "6.7.0",
"semantic-release": "24.0.0",
Expand Down
14 changes: 9 additions & 5 deletions src/fixture.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,17 +8,19 @@ export type Foo<Bar> = (a: Bar) => Bar
* https://github.com/mightyiam/eslint-config-love/issues/2
*/
export default class Zoo {
public constructor (private readonly name: string) {}
public constructor(private readonly name: string) {}

public get greeting (): string {
public get greeting(): string {
return `Hello ${this.name}`
}
}

/**
* https://github.com/mightyiam/eslint-config-love/issues/3
*/
export interface Boo { b_oo: null }
export interface Boo {
b_oo: null
}

/**
* ESLint should ignore this `no-undef` violation because that rule is turned off for TypeScript.
Expand All @@ -29,8 +31,10 @@ export interface Boo { b_oo: null }
* https://github.com/mightyiam/eslint-config-love/issues/110
*/
// Inline callbacks don't need return types:
setTimeout(() => { console.log() }, 1)
setTimeout(() => {
console.log()
}, 1)

// The return type is clear from the left side of the assignment:
const double: ((n: number) => number) = n => n * 2
const double: (n: number) => number = (n) => n * 2
;[1, 2].map(double)
Loading

0 comments on commit f02f695

Please sign in to comment.