GithubHelp home page GithubHelp logo

meteor / eslint-config-meteor Goto Github PK

View Code? Open in Web Editor NEW
7.0 7.0 9.0 20 KB

The ESLint configuration recommended by the Meteor Guide http://guide.meteor.com/

License: MIT License

JavaScript 100.00%

eslint-config-meteor's Introduction

eslint-config-meteor

This is an ESLint configuration for Meteor apps which implements the recommendations from the Meteor Guide's section on Code style.

This repository has been merged into Meteor main repository. You can find it there.

Usage

Install

Install by running:

meteor npm install --save-dev @meteorjs/eslint-config-meteor

Using meteor npm is optional for this package, but best-practice for Meteor projects in general.

Peer Dependencies

This package has several peer dependencies listed in its package.json's peerDependencies section. Warnings will be encountered during the installation step above if the project doesn't already use these modules.

The peer dependencies can be installed manually by following the package.json specification and using meteor npm install --save-dev <package> or, alternatively, using an automated tool:

$ # Install `install-peerdeps` within the current Meteor tool version.
$ meteor npm install --global install-peerdeps
$ # Run the newly installed `install-peerdeps` to install this package and its dependencies.
$ meteor install-peerdeps --dev @meteorjs/eslint-config-meteor

Configure

Add the following to the project's package.json:

"eslintConfig": {
  "extends": "@meteorjs/eslint-config-meteor"
}

eslint-config-meteor's People

Contributors

abernix avatar dburles avatar storytellercz avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

eslint-config-meteor's Issues

Add upper limits to peer dependency versions

You may want to introduce upper limits to your peer dependencies since new rules introduced into them through major releases can mean that the build of people using eslint-config-meteor suddenly fails linting without them doing a major upgrade of anything themselves.

This applies mostly to eslint-plugin-meteor and eslint-config-airbnb.

Cannot find module '@meteorjs/eslint-config-meteor'

After running
meteor npm run lint
I got following error

Cannot find module '@meteorjs/eslint-config-meteor'
Referenced from: c:\Users\abc\Documents\Projects\html\seacorn\package.json
Error: Cannot find module '@meteorjs/eslint-config-meteor'
Referenced from: c:\Users\abc\Documents\Projects\html\seacorn\package.json
    at ModuleResolver.resolve (C:\Users\abc\AppData\Roaming\npm\node_modules\eslint\lib\util\module-resolver.js:74:19)
    at resolve (C:\Users\abc\AppData\Roaming\npm\node_modules\eslint\lib\config\config-file.js:515:25)
    at load (C:\Users\abc\AppData\Roaming\npm\node_modules\eslint\lib\config\config-file.js:532:26)
    at C:\Users\abc\AppData\Roaming\npm\node_modules\eslint\lib\config\config-file.js:424:36
    at Array.reduceRight (native)
    at applyExtends (C:\Users\abc\AppData\Roaming\npm\node_modules\eslint\lib\config\config-file.js:408:28)
    at Object.load (C:\Users\abc\AppData\Roaming\npm\node_modules\eslint\lib\config\config-file.js:566:22)
    at loadConfig (C:\Users\abc\AppData\Roaming\npm\node_modules\eslint\lib\config.js:63:33)
    at getLocalConfig (C:\Users\abc\AppData\Roaming\npm\node_modules\eslint\lib\config.js:130:29)
    at Config.getConfig (C:\Users\abc\AppData\Roaming\npm\node_modules\eslint\lib\config.js:260:26)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! seacorn@ lint: `eslint .`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the seacorn@ lint script 'eslint .'.
npm ERR! Make sure you have the latest version of node.js and npm installed.
npm ERR! If you do, this is most likely a problem with the seacorn package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR!     eslint .
npm ERR! You can get information on how to open an issue for this project with:
npm ERR!     npm bugs seacorn
npm ERR! Or if that isn't available, you can get their info via:
npm ERR!     npm owner ls seacorn
npm ERR! There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     C:\Users\abc\AppData\Local\.meteor\packages\meteor-tool\1.4.4_3\mt-os.windows.x86_32\dev_bundle\.npm\_logs\2017-06-01T15_49_41_421Z-debug.log

Error while running ESLint

Hi, not sure where this is coming from but I am suddenly getting this error when linting:

> eslint --ext .jsx imports/ui

Error: Cannot find module 'babel-runtime/helpers/slicedToArray'

Nothing relevant has changed from the codebase's end; reverting to a commit where I am sure it was still working doesn't solve the problem. Any ideas what this is?

Not resolving local files

Hi, apologies if this a noob error but I've just installed this meteor eslint config to fix the issue of importing from 'meteor/***'.

The problem is that now eslint is no longer able to resolve exports from my local files

For example this import { DrawerMenu } from './DrawerMenu'; is being flagged as unresolved.

Is there a way to combine the meteor import resolver with the local import resolver? It's probably an error in my config, see below.

Many thanks in advance!

.eslintrc.js:

module.exports = {
  parser: 'babel-eslint',
  parserOptions: {
    allowImportExportEverywhere: true,
  },
  env: {
    node: true,
    browser: true,
  },
  plugins: ['meteor'],
  extends: ['airbnb', 'plugin:meteor/recommended'],
  settings: {
    'import/resolver': 'meteor',
  },
  rules: {
    'react/jsx-filename-extension': 0,
    'import/no-absolute-path': 0,
    'import/extensions': 0,

    // disabled so that we're not expecting to find 'meteor' within
    // our dependencies.
    // XXX: this *should* be taken care of by eslint-import-resolver-meteor, investigate.
    'import/no-extraneous-dependencies': 0,

    'no-underscore-dangle': [
      'error',
      {
        allow: ['_id', '_ensureIndex'],
      },
    ],
    'object-shorthand': [
      'error',
      'always',
      {
        avoidQuotes: false,
      },
    ],

    'space-before-function-paren': 0,

    // for Meteor API's that rely on `this` context, e.g. Template.onCreated and publications
    'func-names': 0,
    'prefer-arrow-callback': 0,
  },
};`

package.json

{
  "name": "app",
  "private": true,
  "scripts": {
    "start": "meteor run",
    "test": "meteor test --once --driver-package meteortesting:mocha",
    "test-app": "TEST_WATCH=1 meteor test --full-app --driver-package meteortesting:mocha",
    "visualize": "meteor --production --extra-packages bundle-visualizer"
  },
  "dependencies": {
    "@babel/runtime": "^7.4.5",
    "@material-ui/core": "^4.1.1",
    "@material-ui/icons": "^4.2.0",
    "bcrypt": "^3.0.6",
    "classnames": "^2.2.6",
    "faker": "^4.1.0",
    "formik": "^1.5.7",
    "history": "^4.9.0",
    "material-table": "^1.39.2",
    "meteor-node-stubs": "^0.4.1",
    "moment": "^2.24.0",
    "notistack": "^0.8.7",
    "prop-types": "^15.7.2",
    "proptypes": "^1.1.0",
    "react": "^16.8.6",
    "react-dom": "^16.8.6",
    "react-meteor-hooks": "^0.3.1",
    "react-router": "^5.0.1",
    "react-router-dom": "^5.0.1",
    "recharts": "^1.6.2"
  },
  "meteor": {
    "mainModule": {
      "client": "client/main.jsx",
      "server": "server/main.js"
    },
    "testModule": "tests/main.js"
  },
  "devDependencies": {
    "@meteorjs/eslint-config-meteor": "^1.0.5",
    "babel-eslint": "^9.0.0",
    "eslint": "^5.16.0",
    "eslint-config-airbnb": "^17.1.1",
    "eslint-config-prettier": "^4.3.0",
    "eslint-import-resolver-meteor": "^0.4.0",
    "eslint-plugin-html": "^5.0.5",
    "eslint-plugin-import": "^2.18.0",
    "eslint-plugin-jsx-a11y": "^6.2.3",
    "eslint-plugin-meteor": "^5.1.0",
    "eslint-plugin-prettier": "^3.1.0",
    "eslint-plugin-react": "^7.14.2",
    "eslint-plugin-react-hooks": "^1.6.0",
    "prettier": "^1.18.2"
  }
}

Transfer ownership of eslint-plugin-meteor

Note: This issue is not related to eslint-config-meteor

Hello,

I am the maker and maintainer of eslint-plugin-meteor which is currently getting around 50k downloads per month. I learned a lot about web development from the Meteor community and am thankful for my time there. I have since moved on to other approaches, but I'm still maintaining eslint-plugin-meteor. As it's been a few years since I've last used Meteor, I've lost touch with the latest Meteor developments itself so it's hard for me to know what the best decisions for eslint-plugin-meteor project are.

I previously also made dferber:prerender which was transferred over to the @meteor organisation and eventually became meteor/galaxy-seo-package.

I'd therefore like to hand ownership of eslint-plugin-meteor over to the @meteor organisation. Is this something you are interested in?

Cheers
Dominik

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.