├── .eslintrc ├── .gitignore ├── README.md ├── index.js └── package.json /.eslintrc: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "cleanjs" 3 | } 4 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | .tern-port 2 | /node_modules 3 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | ## DO NOT USE 2 | 3 | This project has never been seriously maintained, and you should be using [eslint-plugin-fp](https://github.com/jfmengels/eslint-plugin-fp) directly instead. 4 | 5 | # eslint-config-cleanjs 6 | 7 | This is an ESLint configuration which aims to restrict you to a subset 8 | of JavaScript which would be as close to an idealised pure functional 9 | language as possible. The idea is to see if it's possible to banish 10 | all the Bad Parts (well, except for the single numeric type being IEEE 11 | 754 floating point) and leave a language without the design flaws 12 | which have plagued JS from the start, and which aren't easy to design 13 | out of the language without becoming a subset of itself. 14 | 15 | Please note that this rule set is meant for use only with ES6 or 16 | higher (and the ES7 object rest spread proposal helps a lot). 17 | 18 | Highlights: 19 | 20 | * no `this` and no classes 21 | * no `null` and `undefined` (implying that all functions must `return`) 22 | * no mutation of any kind 23 | * no variable reassignment 24 | * no statements, only expressions (including no `if`) 25 | * no CommonJS or AMD, only ES6 modules 26 | 27 | This is all based on three ESLint plugins, which you'll have to 28 | install to use these presets: 29 | 30 | * [eslint-plugin-better](https://github.com/idmitriev/eslint-plugin-better) 31 | * [eslint-plugin-fp](https://github.com/jfmengels/eslint-plugin-fp) 32 | * [eslint-plugin-import](https://github.com/benmosher/eslint-plugin-import) 33 | 34 | ## Usage 35 | 36 | Just install this package somewhere your eslint can find it (`npm 37 | install -g eslint-config-cleanjs` if your eslint is installed with 38 | `-g` too), along with the three above mentioned plugins (`npm install -g 39 | eslint-plugin-better eslint-plugin-fp eslint-plugin-import`), and put 40 | this in your `.eslintrc` or wherever you keep your project's eslint 41 | config: 42 | 43 | ``` 44 | { 45 | "extends": "cleanjs" 46 | } 47 | ``` 48 | -------------------------------------------------------------------------------- /index.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | parserOptions: { 3 | ecmaVersion: 7, 4 | sourceType: "module", 5 | experimentalObjectRestSpread: true 6 | }, 7 | plugins: [ 8 | "fp", 9 | "better", 10 | "import" 11 | ], 12 | rules: { 13 | // eslint-plugin-fp rules 14 | "fp/no-arguments": 2, 15 | "fp/no-class": 2, 16 | "fp/no-delete": 2, 17 | "fp/no-events": 2, 18 | "fp/no-get-set": 2, 19 | "fp/no-let": 2, 20 | "fp/no-loops": 2, 21 | "fp/no-mutating-assign": 2, 22 | "fp/no-mutating-methods": 2, 23 | "fp/no-mutation": 2, 24 | "fp/no-nil": 2, 25 | "fp/no-proxy": 2, 26 | "fp/no-rest-parameters": 2, 27 | "fp/no-this": 2, 28 | "fp/no-throw": 2, 29 | "fp/no-unused-expression": 2, 30 | "fp/no-valueof-field": 2, 31 | // eslint-plugin-better rules 32 | "better/no-ifs": 2, 33 | "better/no-instanceofs": 2, 34 | "better/no-new": 2, 35 | "better/explicit-return": 2, 36 | // explicitly disable things handled by eslint-plugin-fp 37 | "better/no-classes": 0, 38 | "better/no-deletes": 0, 39 | "better/no-exceptions": 0, 40 | "better/no-exports": 0, 41 | "better/no-fors": 0, 42 | "better/no-function-expressions": 0, 43 | "better/no-imports": 0, 44 | "better/no-nulls": 0, 45 | "better/no-reassigns": 0, 46 | "better/no-switches": 0, 47 | "better/no-this": 0, 48 | "better/no-typeof": 0, 49 | "better/no-undefined": 0, 50 | "better/no-variable-declaration": 0, 51 | "better/no-whiles": 0, 52 | // eslint-plugin-import rules 53 | "import/no-commonjs": 2, 54 | "import/no-amd": 2, 55 | "import/export": 2, 56 | // eslint standard rules 57 | "no-var": 2, 58 | "prefer-spread": 2 59 | } 60 | }; 61 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "eslint-config-cleanjs", 3 | "version": "4.0.0", 4 | "description": "An eslint config which reduces JS to a pure functional language", 5 | "main": "index.js", 6 | "keywords": [ 7 | "eslint" 8 | ], 9 | "author": "Bodil Stokke", 10 | "license": "LGPL-3.0+", 11 | "repository": { 12 | "type": "git", 13 | "url": "git+https://github.com/bodil/eslint-config-cleanjs.git" 14 | }, 15 | "peerDependencies": { 16 | "eslint": "^3.3.1 || ^4.3.0", 17 | "eslint-plugin-better": "^0.1.5", 18 | "eslint-plugin-fp": "^2.2.0", 19 | "eslint-plugin-import": "^2.2.0" 20 | } 21 | } 22 | --------------------------------------------------------------------------------