Skip to content

Commit

Permalink
v2.0.2 - comma and spacing fixes (#9)
Browse files Browse the repository at this point in the history
* v2.0.0 - Split JS and JSX Rules (#7)

* js, react config export

* try running llocally

* update docs

* upgrade pkgs

* update readme

* minor change

---------

Co-authored-by: nishant.kohli <nishant.kohli@kellton.com>

* v2.0.1- Add and modify rules (#8)

* modify rules

* add array-element-newline rule

* modify comma dangle rule

* add space-infix-ops rule

* add space-before-blocks rule

* add newline-per-chained-call rule

* added @typescript-eslint/no-explicit-any rule

* update README

* update README

---------

Co-authored-by: nishant.kohli <nishant.kohli@kellton.com>

* keyword spacing fix

* comma-dangle rule

* add changelog

* changelog date

* fix conflicts

---------

Co-authored-by: nishant.kohli <nishant.kohli@kellton.com>
  • Loading branch information
nishkohli96 and nish-kellton authored Apr 11, 2024
1 parent 5b3e305 commit 385c702
Show file tree
Hide file tree
Showing 6 changed files with 45 additions and 23 deletions.
17 changes: 16 additions & 1 deletion Changelog.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,20 @@
# **What's changed?**

## [2.0.2](https://github.com/nishkohli96/eslint-config/tree/v2.0.2)

**Released - 12 Apr, 2024**

Modify [space-before-blocks](https://eslint.style/rules/default/space-before-blocks) and [comma-dangle](https://eslint.style/rules/default/comma-dangle) config.

Set keyword spacing to `keywords: 'always'`. Previous config was resulting in no spacing something like,

```
if(){}
catch{
```
Remove comma dangle from arrays and objects, as traling commas were creating unnecessary noise esp in sequelize queries.


## [2.0.1](https://github.com/nishkohli96/eslint-config/tree/v2.0.1)

**Released - 11 Apr, 2024**
Expand All @@ -9,7 +24,7 @@
- [array-element-newline](https://eslint.style/rules/default/array-element-newline)
- [newline-per-chained-call](https://eslint.style/rules/default/newline-per-chained-call)
- [space-before-blocks](https://eslint.style/rules/default/space-before-blocks)
- [space-infix-ops](https://eslint.style/rules/default/sace-infix-ops)
- [space-infix-ops](https://eslint.style/rules/default/space-infix-ops)
- Modify [comma-dangle](https://eslint.style/rules/default/comma-dangle) config.

## [2.0.0](https://github.com/nishkohli96/eslint-config/tree/v2.0.0)
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ All rule names start with `@stylistic/` prefix.
|[arrow-spacing](https://eslint.style/rules/default/arrow-spacing)||
|[block-spacing](https://eslint.style/rules/default/block-spacing)||
|[brace-style](https://eslint.style/rules/default/brace-style)||
|[comma-dangle](https://eslint.style/rules/default/comma-dangle)| { arrays: 'always', objects: 'always', imports: 'never', exports: 'never' functions: 'never' } |
|[comma-dangle](https://eslint.style/rules/default/comma-dangle)| { arrays: 'never', objects: 'never', imports: 'never', exports: 'never' functions: 'never' } |
|[comma-spacing](https://eslint.style/rules/default/comma-spacing)||
|[eol-last](https://eslint.style/rules/default/eol-last)||
|[function-call-argument-newline](https://eslint.style/rules/default/function-call-argument-newline)| consistent |
Expand All @@ -161,7 +161,7 @@ All rule names start with `@stylistic/` prefix.
|[quotes](https://eslint.style/rules/default/quotes)| single |
|[rest-spread-spacing](https://eslint.style/rules/default/rest-spread-spacing)||
|[semi-spacing](https://eslint.style/rules/default/semi-spacing)||
|[space-before-blocks](https://eslint.style/rules/default/space-before-blocks)| { functions: 'always', classes: 'always', keywords: 'never' } |
|[space-before-blocks](https://eslint.style/rules/default/space-before-blocks)| { functions: 'always', classes: 'always', keywords: 'always' } |
|[space-infix-ops](https://eslint.style/rules/default/space-infix-ops)||
|[space-unary-ops](https://eslint.style/rules/default/space-unary-ops)||
|[spaced-comment](https://eslint.style/rules/default/spaced-comment)||
Expand Down
6 changes: 5 additions & 1 deletion __tests__/bad-js.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,10 @@ const func = (e) => console.log('some function');
const obj = { name: 'john', age: 36}

const res = a?b:c
const vb={data:{url:'bla bla'}}

const yu='color'
var op={'$User.name':{[yu]:'#007aba'}}

function a(){}
function someFN(var1,var2,var3){return var1-var2+var3}
Expand All @@ -19,7 +23,7 @@ class Foo{
constructor(){}
}

for (;;) {
for(;;){
// ...
}

Expand Down
35 changes: 19 additions & 16 deletions lib/js/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,7 @@

module.exports = {
root: true,
extends: [
'eslint:recommended',
'plugin:@typescript-eslint/recommended',
],
extends: ['eslint:recommended', 'plugin:@typescript-eslint/recommended'],
parser: '@typescript-eslint/parser',
plugins: ['@typescript-eslint', '@stylistic'],
env: {
Expand All @@ -32,13 +29,16 @@ module.exports = {
'@stylistic/arrow-spacing': 'warn',
'@stylistic/block-spacing': 'warn',
'@stylistic/brace-style': 'warn',
'@stylistic/comma-dangle': ['warn', {
arrays: 'always',
objects: 'always',
imports: 'never',
exports: 'never',
functions: 'never'
}],
'@stylistic/comma-dangle': [
'warn',
{
arrays: 'never',
objects: 'never',
imports: 'never',
exports: 'never',
functions: 'never',
},
],
'@stylistic/comma-spacing': 'warn',
'@stylistic/eol-last': 'warn',
'@stylistic/function-call-argument-newline': ['warn', 'consistent'],
Expand All @@ -62,11 +62,14 @@ module.exports = {
'@stylistic/quotes': ['warn', 'single'],
'@stylistic/rest-spread-spacing': 'warn',
'@stylistic/semi-spacing': 'warn',
'@stylistic/space-before-blocks': ['warn', {
functions: 'always',
classes: 'always',
keywords: 'never'
}],
'@stylistic/space-before-blocks': [
'warn',
{
functions: 'always',
classes: 'always',
keywords: 'always',
},
],
'@stylistic/space-infix-ops': 'warn',
'@stylistic/space-unary-ops': [
'warn',
Expand Down
4 changes: 2 additions & 2 deletions package-lock.json

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

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@nish1896/eslint-config",
"version": "2.0.1",
"version": "2.0.2",
"description": "eslint and stylistic rules to help you focus more on the code logic, while they take care of the code formatting",
"author": "Nishant Kohli",
"exports": {
Expand Down

0 comments on commit 385c702

Please sign in to comment.