Created
September 2, 2021 14:36
-
-
Save harryadel/3f2c30974639b39c3518a8cc4c5b2127 to your computer and use it in GitHub Desktop.
Example Meteor Eslint and Prettier config files
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
.meteor | |
.tmp | |
node_modules/ | |
.build | |
packages/ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Show hidden characters
{ | |
"parserOptions": { | |
"ecmaVersion": 2020, | |
"sourceType": "module", | |
"ecmaFeatures": { | |
"jsx": true | |
} | |
}, | |
"env": { | |
"es6": true, | |
"browser": true, | |
"node": true, | |
"meteor": true | |
}, | |
"parser": "babel-eslint", | |
"plugins": ["meteor", "babel", "react", "react-hooks", "prettier"], | |
"extends": [ | |
"airbnb", | |
"airbnb/hooks", | |
"plugin:meteor/recommended", | |
"plugin:react/recommended", | |
"prettier" | |
], | |
"settings": { | |
"react": { | |
"version": "detect", | |
"pragma": "React" | |
}, | |
"import/resolver": { | |
"node": { | |
"extensions": [".js", ".jsx", ".ts", ".tsx", ".json"], | |
"moduleDirectory": ["node_modules", "./"] | |
}, | |
"meteor": { | |
"extensions": [".js", ".jsx"] | |
} | |
} | |
}, | |
//Applies recommened Rules, exceptions below | |
"rules": { | |
// Default | |
"meteor/eventmap-params": [ | |
2, | |
{ | |
"eventParamName": "e", | |
"templateInstanceParamName": "template" | |
} | |
], | |
//(e, template) | |
"no-unused-vars": [ | |
"error", | |
{ | |
"args": "none" | |
} | |
], | |
//Must use all declared vars | |
"curly": ["error", "multi-or-nest", "consistent"], | |
//handles unnessecary curlys | |
"eqeqeq": ["error", "always"], | |
//enforce === & !== | |
// "brace-style": ["error", "stroustrup"], ?? can not use with prettier | |
"brace-style": ["error", "1tbs"], | |
//All braces start on line of declaration | |
"no-multiple-empty-lines": [ | |
"error", | |
{ | |
"max": 1 | |
} | |
], | |
//Only one empty line in a row allowed | |
"object-property-newline": [ | |
"error", | |
{ | |
"allowAllPropertiesOnSameLine": true | |
} | |
], | |
//Objects either must be on one line or one for each field | |
"array-bracket-newline": ["error", "consistent"], | |
//Array with multiple elements should always be multi-line | |
"no-console": [ | |
"error", | |
{ | |
"allow": ["warn", "error", "log"] | |
} | |
], | |
//Allow these console uses/may want to remove for publish | |
"no-undef": "off", | |
//Get rid of no definition so we don't have to declare a bunch of Meteor Specific globals | |
"meteor/audit-argument-checks": "off", | |
//Remove rule that tests that all arguments are used in a function | |
"no-case-declarations": "off", | |
//Remove rule requiring braces for switch statements | |
"no-inner-declarations": "off", | |
//Remove rule preventing variable declarations inside of functions | |
"indent": [ | |
"error", | |
"tab", | |
{ | |
"SwitchCase": 1 | |
} | |
], | |
//Indent with tabs | |
"padding-line-between-statements": [ | |
"error", | |
{ | |
"blankLine": "always", | |
"prev": "*", | |
"next": ["block-like", "for", "while", "multiline-const", "function", "return"] | |
}, | |
//Insert blank line after these elements | |
{ | |
"blankLine": "never", | |
"prev": ["singleline-const"], | |
"next": ["singleline-const"] | |
}, | |
//Dont add spaces inbetween two const variable declerations | |
{ | |
"blankLine": "never", | |
"prev": ["singleline-let"], | |
"next": ["singleline-let"] | |
} | |
//Dont add spaces inbetween two const variable declerations | |
], | |
"space-before-blocks": "error", | |
//Requires spaces after function declarations | |
"arrow-spacing": "error", | |
//Requires spaces before and after => | |
"semi": "error", | |
"no-extra-boolean-cast": "off", | |
//Enforce consistent quotes style | |
"quotes": ["error", "single"], | |
// Extends | |
"react/prop-types": "error", | |
"react/jsx-filename-extension": [1, { "extensions": [".js", ".jsx", ".ts", ".tsx"] }], | |
"react/jsx-props-no-spreading": 0, | |
"import/prefer-default-export": 0, | |
"import/named": 2, | |
"import/namespace": 2, | |
"import/default": 2, | |
"import/export": 2, | |
"react/state-in-constructor": 0, | |
"react/static-property-placement": 0, | |
"camelcase": 0, | |
"jsx-a11y/mouse-events-have-key-events": 0, | |
"react/jsx-curly-newline": 0, | |
"jsx-a11y/label-has-associated-control": [ | |
"error", | |
{ | |
"required": { | |
"some": ["nesting", "id"] | |
} | |
} | |
], | |
"import/extensions": [ | |
"error", | |
"ignorePackages", | |
{ | |
"js": "never", | |
"jsx": "never", | |
"ts": "never", | |
"tsx": "never" | |
} | |
], | |
"react/sort-comp": 0, | |
"react/jsx-wrap-multilines": 0, | |
"react-hooks/rules-of-hooks": "error", | |
"react-hooks/exhaustive-deps": "warn", | |
"import/no-dynamic-require": "off", | |
"@typescript-eslint/no-var-requires": "off", | |
"global-require": "off", | |
"no-use-before-define": "off", | |
"no-shadow": "off", | |
"no-redeclare": "off", | |
"react/react-in-jsx-scope": "off", | |
"react/require-default-props": "off", | |
"react/no-danger": "off", | |
"no-underscore-dangle": "off", | |
"no-alert": "off", | |
"import/no-absolute-path": "off" // Meteor could use absolute path for "imports" | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
.meteor | |
.tmp | |
node_modules/ | |
.build | |
packages/ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"printWidth": 120, | |
"useTabs": true, | |
"tabWidth": 4, | |
"semi": true, | |
"singleQuote": true, | |
"trailingComma": "es5", | |
"bracketSpacing": true, | |
"jsxBracketSameLine": false, | |
"arrowParens": "avoid" | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"name": "eslint-meteor", | |
"private": true, | |
"scripts": { | |
"test": "meteor --settings ./settings.dev.json test --port 3030 --once --driver-package meteortesting:mocha", | |
"start": "meteor --settings settings.dev.json", | |
"dev": "meteor run --settings settings.dev.json --inspect", | |
"test-app": "TEST_WATCH=1 meteor test --full-app --driver-package meteortesting:mocha", | |
"visualize": "meteor --production --extra-packages bundle-visualizer", | |
"lint:base": "eslint --ext .js .jsx .ts,.tsx ./", | |
"lint:styles": "stylelint '**/*.scss' --fix", | |
"lint": "npm lint:base --fix --cache --cache-location=./node_modules/.cache/", | |
"prepare": "husky install" | |
}, | |
"dependencies": { | |
"bcrypt": "^5.0.1", | |
"simpl-schema": "^1.12.0" | |
}, | |
"meteor": { | |
"testModule": "server/tests/index.js" | |
}, | |
"devDependencies": { | |
"@babel/runtime": "^7.15.3", | |
"@meteorjs/eslint-config-meteor": "^1.0.5", | |
"babel": "^6.23.0", | |
"babel-eslint": "^10.1.0", | |
"eslint": "^7.32.0", | |
"eslint-config-airbnb": "^18.2.1", | |
"eslint-config-prettier": "^8.3.0", | |
"eslint-import-resolver-meteor": "^0.4.0", | |
"eslint-plugin-babel": "^5.3.1", | |
"eslint-plugin-import": "^2.24.2", | |
"eslint-plugin-jsx-a11y": "^6.4.1", | |
"eslint-plugin-meteor": "^7.3.0", | |
"eslint-plugin-prettier": "^4.0.0", | |
"eslint-plugin-react": "^7.25.1", | |
"eslint-plugin-react-hooks": "^4.2.0", | |
"expect": "^27.1.0", | |
"husky": "^7.0.2", | |
"nock": "^13.1.3", | |
"prettier": "^2.3.2", | |
"sinon": "^11.1.2" | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment