ABuffSeagull / eslint-import-resolver-parcel

Parcel import resolution plugin for eslint-plugin-import
MIT License
12 stars 2 forks source link

Eslint Importer Still not resolving (React) #1

Closed TDKRage closed 5 years ago

TDKRage commented 5 years ago

Hi Thanks For Creating this package.

Im still having issues with eslint import resolver,

.eslinrc.js

var path = require('path');

module.exports = {
  "env": {
    "browser": true,
    "jest": true,
    "node": true
  },
  "extends": "airbnb",
  "rules": {
    "linebreak-style": ["off", process.env.NODE_ENV === 'production' ? "unix" : "windows"],
    "function-paren-newline": ["error", "consistent"],
    "jsx-a11y/anchor-is-valid": "off",
    "jsx-a11y/label-has-for": "off",
    "max-len": [2, 160],
    "no-tabs": 0,
    "object-curly-newline": ["error", { "consistent": true }],
    "react/no-typos": "off",
    "react/jsx-one-expression-per-line": "off",
    "react/destructuring-assignment": "off",
    "no-multiple-empty-lines": "off",
    "implicit-arrow-linebreak": "off",
    "operator-linebreak": "off",
  },
  "parser": "babel-eslint",
  "parserOptions": {
    "allowImportExportEverywhere": true
  },
  "settings": {
    "import/resolver": {
      "parcel": {
        "rootDir": "src"
      }
    }
  },
};

Routes.jsx

import React, { Fragment } from 'react';
import { Route } from 'react-router-dom';

import Home from '/pages/home'; // Wont resolve 

import { home } from './urls';

const Routes = () => (
  <Fragment>
    <Route exact path={home()} component={Home} />
  </Fragment>
);

export default Routes;

Folder Structure: image

Can view my project at : https://github.com/TDKRage/parcel-react-starter

Am I using the package correctly?

ABuffSeagull commented 5 years ago

Oh, I misinterpreted something in the parcel docs, and assumed you should always include the extension for imports. So if you include the extension, it'll work. That'll be the next thing I work on.

ABuffSeagull commented 5 years ago

Aight, should work without having to specify the extension anymore.

TDKRage commented 5 years ago

Thanks A million! Well done on this package it is much needed. still n00b to parcel but i like it.