Skip to content

Commit

Permalink
Merge pull request #45 from codex-team/2.0
Browse files Browse the repository at this point in the history
feat(2.0): eslint 9, configs updated, vue config added
  • Loading branch information
neSpecc authored Apr 20, 2024
2 parents 492d4f4 + d922448 commit 9a7358f
Show file tree
Hide file tree
Showing 36 changed files with 2,078 additions and 1,226 deletions.
7 changes: 7 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
[*]
charset = utf-8
indent_style = space
end_of_line = lf
insert_final_newline = true
trim_trailing_whitespace = true
indent_size = 2
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
node_modules/
.idea/
*.log
.DS_Store
1 change: 1 addition & 0 deletions .nvmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
v20
67 changes: 43 additions & 24 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,46 +1,65 @@
# CodeX basic ESLint configuration
# CodeX ESLint configuration

- [Flat config](https://eslint.org/docs/latest/use/configure/configuration-files), ESLint 9
- JavaScript and TypeScript configs
- Vue.js config (TS)
- Node.js
- Codestyle config
- JSDoc configs for JS and TS
- Global variables list
- Gitignore support

## Install

Add package to your dev-dependencies using npm or yarn:

```bash
$ npm i -D eslint-config-codex eslint

$ yarn add -D eslint-config-codex eslint
yarn add -D eslint-config-codex eslint
```

## Usage in JavaScript
## Usage

Add `.eslintrc` file to your project's root if you don't have it.
Add following lines to your `eslint.config.mjs`:

```bash
npm init @eslint/config
```js
import CodeX from 'eslint-config-codex'

export default [
...CodeX,
// your customization
]
```

Then add the `extends` section to there:
## VSCode suport

```json
{
"extends": [
"codex"
]
}
```
Open `Code` / `Settings`, find "Open Settings (JSON)" icon at the top-bar

## Usage in TypeScript
Then fill opened `.vscode/settings.json`:

1. Follow instructions for JavaScript
2. Extend from `codex/ts` instead of `codex`
```jsonc
// Enable the ESlint flat config support
"eslint.experimental.useFlatConfig": true,

```json
{
"extends": [
"codex/ts"
// Disable the default formatter, use eslint instead
"prettier.enable": false,
"editor.formatOnSave": false,

// Auto fix
"editor.codeActionsOnSave": {
"source.fixAll.eslint": "explicit",
"source.organizeImports": "never"
},

// Enable eslint for all supported languages
"eslint.validate": [
"javascript",
"typescript",
"vue",
"html",
]
}
```


## Troubleshooting

### ESLint couldn't determine the plugin ... uniquely
Expand Down
231 changes: 0 additions & 231 deletions common.json

This file was deleted.

19 changes: 19 additions & 0 deletions eslint.config.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
import JavaScript from './src/configs/javascript.mjs';
import TypeScript from './src/configs/typescript.mjs';
import JsDoc from './src/configs/jsdoc.mjs';
import CodeStyle from './src/configs/codestyle.mjs';
import Vue from './src/configs/vue.mjs';
import Node from './src/configs/node.mjs';
import Globals from './src/configs/globals.mjs';
import Ignore from './src/configs/ignore.mjs';

export default [
...Ignore,
...Globals,
...CodeStyle,
...JavaScript,
...TypeScript,
...Node,
...JsDoc,
...Vue,
];
6 changes: 0 additions & 6 deletions eslintrc.json

This file was deleted.

3 changes: 2 additions & 1 deletion index.js
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
module.exports = require('./eslintrc');
import CodeX from './eslint.config.mjs';
export default CodeX;
Loading

0 comments on commit 9a7358f

Please sign in to comment.