Skip to content
This repository has been archived by the owner on May 7, 2024. It is now read-only.

Commit

Permalink
Add max-len rule and module sourceType
Browse files Browse the repository at this point in the history
  • Loading branch information
dgchrt committed Nov 20, 2023
1 parent f178579 commit 897ac91
Show file tree
Hide file tree
Showing 2 changed files with 66 additions and 50 deletions.
16 changes: 16 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,25 +4,41 @@
[![npm version](https://img.shields.io/npm/v/eslint-config-classic.svg)](https://www.npmjs.com/package/eslint-config-classic)

# eslint-config-classic

[ESlint](https://eslint.org) rules for classic-style JavaScript.

## Install

```
npm install --save-dev eslint-config-classic
```

## Usage

Add a `.eslintrc.js` file to your project with these lines:

```
module.exports = {
"extends": "classic"
};
```

### Optional

Add a `lint` script in `package.json`. Adding the `--fix` parameter will automatically fix files:

```
"scripts": {
"lint": "eslint --fix ."
},
```

#### Visual Studio Code

To have the ESLint plugin on Visual Studio Code automatically fix errors, add this configuration:

```json
"editor.codeActionsOnSave": {
"source.fixAll.eslint": true
},
```
100 changes: 50 additions & 50 deletions index.js
Original file line number Diff line number Diff line change
@@ -1,68 +1,68 @@
module.exports = {
"env": {
"browser": true,
"commonjs": true,
"es2020": true,
"node": true
},
"use strict";

"extends": "eslint:recommended",
/**
* Statements that can become multi-line blocks of code.
* Source: https://eslint.org/docs/latest/rules/padding-line-between-statements
*/
const MULTILINE_STATEMENT_TYPES = [
"block-like",
"expression",
"multiline-const",
"multiline-expression",
"multiline-let",
"multiline-var",
];

"parserOptions": {
"ecmaVersion": 11
module.exports = {
env: {
browser: true,
commonjs: true,
es2020: true,
node: true,
},

"rules": {
"brace-style": [
"error",
"1tbs"
],

"curly": 2,

"indent": [
"error",
"tab"
],

extends: ["eslint:recommended", "plugin:prettier/recommended"],
parserOptions: {
ecmaVersion: 11,
sourceType: "module",
},
plugins: ["prettier"],
rules: {
"brace-style": ["error", "1tbs"],
curly: 2,
indent: ["error", "tab"],
"keyword-spacing": 2,

"linebreak-style": [
"linebreak-style": ["error", "unix"],
"max-len": [
"error",
"unix"
],

"no-else-return": [
"error"
{
code: 80,
},
],

"no-else-return": ["error"],
"no-multiple-empty-lines": [
"error",

{
max: 1,
maxBOF: 0,
maxEOF: 1
}
maxEOF: 1,
},
],

"no-multi-spaces": "error",
"no-trailing-spaces": "error",

"padding-line-between-statements": [
"error",
{ "blankLine": "always", "prev": "*", "next": "block-like" },
{ "blankLine": "always", "prev": "block-like", "next": "*" }
],

"quotes": [
"error",
"double"
{
blankLine: "always",
prev: "*",
next: MULTILINE_STATEMENT_TYPES,
},
{
blankLine: "always",
prev: MULTILINE_STATEMENT_TYPES,
next: "*",
},
],

"semi": [
"error",
"always"
]
}
quotes: ["error", "double"],
semi: ["error", "always"],
},
};

0 comments on commit 897ac91

Please sign in to comment.